Example #1
0
        public static List <UI_WFEntity_Info> GetWFEntityByHistoryDone(System.Linq.Expressions.Expression <Func <Mission, bool> > condition)
        {
            List <UI_WFEntity_Info> wfe_info = new List <UI_WFEntity_Info>();

            WorkFlows wfs = new WorkFlows();

            List <WorkFlow_Entity> wfes = null;

            //List<WorkFlow_Entity> wfes = wfs.GetWFEntityByConditon(s => s.Process_Info.wh );
            try
            {
                using (var db = new WorkFlowContext())
                {
                    wfes = db.mission.Where(condition).Select(a => a.Miss_WFentity).Distinct().Where(s => s.WE_Status == WE_STATUS.DONE).ToList();
                }
            }
            catch (Exception e)
            {
                return(null);
            }

            foreach (WorkFlow_Entity fe in wfes)
            {
                UI_WFEntity_Info fe_info = new UI_WFEntity_Info();
                fe_info.name        = wfs.GetWorkFlowEntityName(fe.WE_Id);
                fe_info.Status      = fe.WE_Status;
                fe_info.EntityID    = fe.WE_Id;
                fe_info.description = wfs.GetWorkFlowEntityDesc(fe.WE_Id);
                fe_info.serial      = fe.WE_Ser;
                wfe_info.Add(fe_info);
            }
            return(wfe_info);
        }
Example #2
0
        protected void InitFlowInfo()
        {
            int AppInstanceID = Request.QueryString["AppInstanceID"] == null ? 0 : Helper.ConverToInt32(Request.QueryString["AppInstanceID"].ToString());

            if (AppInstanceID > 0)
            {
                HrsLeaveEntity hrsLeaveEntity = WorkFlows.GetHrsLeaveModel(AppInstanceID);
                if (hrsLeaveEntity != null && hrsLeaveEntity.ID > 0)
                {
                    selectLeaveType.Value    = hrsLeaveEntity.LeaveType.ToString();
                    selectLeaveType.Disabled = true;
                    txtDays.Value            = hrsLeaveEntity.Days.ToString();
                    txtFromDate.Value        = hrsLeaveEntity.FromDate.ToString("yyyy-MM-dd");
                    txtToDate.Value          = hrsLeaveEntity.ToDate.ToString("yyyy-MM-dd");

                    this.txtDepmanagerRemark.Value     = hrsLeaveEntity.DepManagerRemark;
                    this.txtDirectorRemark.Value       = hrsLeaveEntity.DirectorRemark;       //主管总监
                    this.txtDeputyGeneralRemark.Value  = hrsLeaveEntity.DeputyGeneralRemark;  //副总经理
                    this.txtGeneralManagerRemark.Value = hrsLeaveEntity.GeneralManagerRemark; //总经理

                    txtCreatedByUserName.Value = hrsLeaveEntity.CreatedUserName;
                    txtCreatedDateTime.Value   = hrsLeaveEntity.CreatedDate.ToString("yyyy-MM-dd");
                }
            }
        }
Example #3
0
        /// <summary>
        /// 将Record添加到subprocess
        /// </summary>
        private static void Post_processSubprocess(IEvent ev, IDictionary <string, string> record)
        {
            if (record == null)
            {
                return;
            }

            CSubProcessEvent sp = (CSubProcessEvent)ev;

            List <UI_MISSION> miss = GetHistoryMissions(sp.WfEntityId);

            WorkFlows wfs = new WorkFlows();

            foreach (UI_MISSION mi in miss)
            {
                List <Process_Record> prs = new List <Process_Record>();
                foreach (var re in record)
                {
                    Process_Record pr = new Process_Record();
                    pr.Re_Name  = re.Key;
                    pr.Re_Value = re.Value;
                    prs.Add(pr);
                }
                wfs.LinkRecordInfoToMiss(mi.Miss_Id, prs);
            }
            //SubmitSignal(sp.WfEntityId, new Dictionary<string, string>(), record);
        }
Example #4
0
        /// <summary>
        /// 将当前任务更新到数据库CURR_Misson
        /// </summary>
        /// <param name="clearFlag"></param>
        protected void UpdateCurrentEvent(bool clearFlag = false)
        {
            CURR_Mission cur_mis = new CURR_Mission();

            cur_mis.After_Action = afteraction;
            cur_mis.Before_Action = beforeaction;
            cur_mis.Current_Action = currentaction;
            cur_mis.Miss_Desc = description;
            cur_mis.Miss_Name = name;

            //将内部变量的值预填充到权限认证字符串
            Dictionary<string, object> inter_params = new Dictionary<string, object>();
            foreach (var pa in m_params)
                inter_params[pa.Key] = pa.Value.value;

            cur_mis.Str_Authority = m_authority.FillParams(inter_params, null);
            
            try
            {
                WorkFlows wfs = new WorkFlows();
                if (clearFlag == true)
                    wfs.UpdateCurrentMission(m_parentWF.EntityID, null);
                else
                    wfs.UpdateCurrentMission(m_parentWF.EntityID, cur_mis);
            }
            catch(Exception e)
            {
                Trace.WriteLine("UpdateCurrentEvent error:" + e.Message);
            }
            
        }
Example #5
0
        /// <summary>
        /// 该事件的处理函数
        /// </summary>
        protected override void __processing()
        {
            WE_STATUS status = WE_STATUS.SUSPEND;
            WorkFlows wfs    = new WorkFlows();

            try
            {
                switch ((string)m_run_params)
                {
                case "SUSPEND":
                    status = WE_STATUS.SUSPEND;
                    wfs.UpdateWorkFlowEntity(m_wfentityID, "WE_Status", status);
                    break;

                case "DELETE":
                    status = WE_STATUS.DELETED;
                    wfs.UpdateWorkFlowEntity(m_wfentityID, "WE_Status", status);
                    break;

                default:
                    break;
                }
                //调用用户定义的回调URL
                _CustomCallBack();
                this.status = TM_STATUS.TM_FINISH;
            }
            catch
            {
                Trace.WriteLine("Timeout processing exception!");
            }
        }
Example #6
0
        //fhp添加方法结束-----

        /// <summary>
        /// 或的工作流的信息以及指定变量的值
        /// </summary>
        /// <param name="wfe_id">工作流实体ID</param>
        /// <param name="paras">变量列表
        /// 例如: 要获得工作流(ID 为 4)的Equip_GyCode的当前值,则:
        /// Dictionary paras = new Dictionary();
        /// paras["Equip_GyCode"] = null;
        /// UI_WFEntity_Info wfei = GetWorkFlowEntityWithParams(4, paras);
        ///
        /// 调用完成后, wfei返回了 name, description, EntityID, serial, Status
        /// 而paras["Equip_GyCode"] 将会被设置为正确值
        /// </param>
        /// <returns></returns>
        public static UI_WFEntity_Info GetWorkFlowEntityWithParams(int wfe_id, IDictionary <string, object> paras)
        {
            UI_WFEntity_Info wfe  = new UI_WFEntity_Info();
            WorkFlows        wfs  = new WorkFlows();
            WorkFlow_Entity  wfe1 = wfs.GetWorkFlowEntity(wfe_id);

            CWorkFlow   wf  = new CWorkFlow();
            XmlDocument doc = new XmlDocument();

            doc.LoadXml(Encoding.Default.GetString(wfe1.WE_Binary));
            XmlNode xml = doc.DocumentElement;

            wf.ParaseBaseInfo(xml);
            wf.ParseParams(xml.SelectSingleNode("paramtable"));

            Dictionary <string, object> _tmp = new Dictionary <string, object>(paras);

            foreach (var par in _tmp)
            {
                paras[par.Key] = wf.paramstable[par.Key].value;
            }


            wfe.name        = wf.name;
            wfe.description = wf.description;
            wfe.EntityID    = wf.EntityID;
            wfe.serial      = wf.EntitySerial;
            wfe.Status      = wfe1.WE_Status;
            return(wfe);
        }
Example #7
0
        /// <summary>
        /// 通过工作流实体的id获得工作流实体
        /// </summary>
        /// <param name="wfe_id"></param>
        /// <returns></returns>
        public static UI_WFEntity_Info GetWorkFlowEntiy(int wfe_id, bool FullInfo = false)
        {
            UI_WFEntity_Info wfe  = new UI_WFEntity_Info();
            WorkFlows        wfs  = new WorkFlows();
            WorkFlow_Entity  wfe1 = wfs.GetWorkFlowEntity(wfe_id);

            if (FullInfo)
            {
                CWorkFlow   wf  = new CWorkFlow();
                XmlDocument doc = new XmlDocument();
                doc.LoadXml(Encoding.Default.GetString(wfe1.WE_Binary));
                XmlNode xml = doc.DocumentElement;
                wf.ParaseBaseInfo(xml);
                WorkFlow_Define wfd = wfs.GetWorkFlowDefine(wfe_id);
                //wfe.name = wfd.W_Name;
                //wfe.description = wfd.W_Attribution;
                wfe.Binary      = Encoding.Default.GetString(wfe1.WE_Binary);
                wfe.name        = wf.name;
                wfe.description = wf.description;
            }

            wfe.EntityID       = wfe1.WE_Id;
            wfe.serial         = wfe1.WE_Ser;
            wfe.Status         = wfe1.WE_Status;
            wfe.Last_TransTime = wfe1.Last_Trans_Time;
            return(wfe);
        }
Example #8
0
        protected void InsertMissionToDB()
        {
            WorkFlows wfs = new WorkFlows();

            Mission mis = new Mission();
            mis.Miss_Name = this.name;
            mis.Miss_WFentity = null;
            mis.Miss_Desc = this.description;
            mis.Event_Name = this.name;
            mis.next_Mission = null;
            mis.pre_Mission = null;
            mis.Record_Info = null;
            try
            {
                wfs.AddMissionRecord(m_parentWF.EntityID, mis);
                List<Mission_Param> pars = new List<Mission_Param>();
                foreach(var pa in m_params)
                {
                    Mission_Param par = new Mission_Param();
                    par.Param_Name = pa.Value.name;
                    par.Param_Type = pa.Value.type;
                    par.Param_Value = Convert.ToString(pa.Value.value);
                    par.Param_Desc = pa.Value.description;
                    pars.Add(par);
                }
                wfs.LinkParamsToMiss(mis.Miss_Id, pars);
            }
            catch(Exception e)
            {
                return;
            }
        }
Example #9
0
        protected void InitFlowInfo()
        {
            string AppInstanceID = Request.QueryString["AppInstanceID"] == null ? string.Empty : Request.QueryString["AppInstanceID"].ToString();

            if (!string.IsNullOrEmpty(AppInstanceID))
            {
                int            leaveID        = int.Parse(AppInstanceID);
                HrsLeaveEntity hrsLeaveEntity = WorkFlows.GetHrsLeaveModel(leaveID);
                if (hrsLeaveEntity != null && hrsLeaveEntity.ID > 0)
                {
                    selectLeaveType.Value    = hrsLeaveEntity.LeaveType.ToString();
                    selectLeaveType.Disabled = true;
                    txtDays.Value            = hrsLeaveEntity.Days.ToString();
                    txtFromDate.Value        = hrsLeaveEntity.FromDate.ToString("yyyy-MM-dd");
                    txtToDate.Value          = hrsLeaveEntity.ToDate.ToString("yyyy-MM-dd");

                    this.txtDepmanagerRemark.Value     = hrsLeaveEntity.DepManagerRemark;
                    this.txtDirectorRemark.Value       = hrsLeaveEntity.DirectorRemark;       //主管总监
                    this.txtDeputyGeneralRemark.Value  = hrsLeaveEntity.DeputyGeneralRemark;  //副总经理
                    this.txtGeneralManagerRemark.Value = hrsLeaveEntity.GeneralManagerRemark; //总经理

                    txtCreatedByUserName.Value = hrsLeaveEntity.CreatedUserName;
                    txtCreatedDateTime.Value   = hrsLeaveEntity.CreatedDate.ToString("yyyy-MM-dd");
                }
            }
        }
Example #10
0
        public bool CreateEntity(string wf_name, string Ser_Num = null/*2016/2/12--保证子工作流串号与父工作流相同*/)
        {
            WorkFlows wfs = new WorkFlows();

            XmlDocument doc = new XmlDocument();
            WorkFlow_Define define = wfs.GetWorkFlowDefine(wf_name);
            doc.LoadXml(Encoding.Default.GetString(define.W_Xml));
            InstFromXmlNode((XmlNode)doc.DocumentElement);

           

            WorkFlow_Entity wfe = new WorkFlow_Entity();
            wfe.WE_Status = WE_STATUS.CREATED;
            wfe.WE_Binary = Encoding.Default.GetBytes(WriteToXmlNode().OuterXml);
            
                //wfe.Create_Info = SaveCreateRecord();
            //2016/2/12 --保证子工作流串号与父工作流相同
            if (Ser_Num == null)
                wfe.WE_Ser = "";
            else
                wfe.WE_Ser = Ser_Num;            

            if (!wfs.AddWorkEntity(wf_name, wfe))
                return false;

            m_entityID = wfe.WE_Id;
            m_entitySerial = wfe.WE_Ser;
            m_defineID = define.W_ID;

            RegEventsTimeOut(true);   
            return true;

        }
Example #11
0
        public JsonResult ListKeyParams(int defId)
        {
            List <object> pars = new List <object>();

            if (defId == -1)
            {
                return(Json(new { data = pars.ToArray() }));
            }

            CWorkFlow   wf  = new CWorkFlow();
            WorkFlows   wfs = new WorkFlows();
            XmlDocument doc = new XmlDocument();

            doc.LoadXml(Encoding.Default.GetString(wfs.GetWorkFlowDefineByID(defId).W_Xml));
            wf.InstFromXmlNode((XmlNode)doc.DocumentElement);

            var ev = wf.events["Start"];

            foreach (var k in ev.paramlist)
            {
                pars.Add(new
                {
                    par_name  = k.Value.name,
                    par_desc  = k.Value.description,
                    par_value = ""
                });
            }

            return(Json(new { data = pars.ToArray() }));
        }
Example #12
0
        //返回一个工作流定义
        public static UI_WF_Define GetWorkFlowDefine(string wf_name)
        {
            WorkFlows       wfs    = new WorkFlows();
            WorkFlow_Define wfd    = wfs.GetWorkFlowDefine(wf_name);
            UI_WF_Define    ui_wfd = new UI_WF_Define {
                wf_name = wfd.W_Name, wf_description = wfd.W_Attribution
            };

            return(ui_wfd);
        }
Example #13
0
        public static IDictionary <string, string> GetMissionRecordInfo(int wfe_id)
        {
            WorkFlows                   wfs = new WorkFlows();
            List <Process_Record>       Pre = wfs.GetMissionRecordInfo(wfe_id);
            Dictionary <string, string> res = new Dictionary <string, string>();

            foreach (var p in Pre)
            {
                res[p.Re_Name] = p.Re_Value;
            }
            return(res);
        }
Example #14
0
        public string get_equip_info(string wfe_id)
        {
            WorkFlows wfsd    = new WorkFlows();
            Mission   db_miss = wfsd.GetWFEntityMissions(Convert.ToInt16(wfe_id)).Last();//获取该实体最后一个任务


            WorkFlow_Entity wfe = wfsd.GetWorkFlowEntity(Convert.ToInt16(wfe_id));
            //CWorkFlow wf = new CWorkFlow();
            WorkFlows  wfs = new WorkFlows();
            UI_MISSION ui  = new UI_MISSION();

            ui.WE_Entity_Ser = wfe.WE_Ser;
            ui.WE_Event_Desc = db_miss.Miss_Desc;
            ui.WE_Event_Name = db_miss.Event_Name;
            ui.WE_Name       = db_miss.Miss_Name;
            ui.Mission_Url   = "";                                               //历史任务的页面至空
            ui.Miss_Id       = db_miss.Miss_Id;
            List <Mission_Param> mis_pars = wfsd.GetMissParams(db_miss.Miss_Id); //获取当前任务参数

            foreach (var par in mis_pars)
            {
                CParam cp = new CParam();
                cp.type                     = par.Param_Type;
                cp.name                     = par.Param_Name;
                cp.value                    = par.Param_Value;
                cp.description              = par.Param_Desc;
                ui.Miss_Params[cp.name]     = cp.value;
                ui.Miss_ParamsDesc[cp.name] = cp.description;
            }
            List <EquipListModel> EquipList = Zz_Equips(ui.Miss_Params["Zz_Name"].ToString());
            List <object>         miss_obj  = new List <object>();
            int i = 1;

            foreach (var item in EquipList)
            {
                object m = new
                {
                    index           = i,
                    Equip_Id        = item.Equip_Id,
                    Equip_GyCode    = item.Equip_GyCode,
                    Equip_Code      = item.Equip_Code,
                    Equip_Type      = item.Equip_Type,
                    Equip_Specialty = item.Equip_Specialty,
                    Equip_ABCMark   = item.Equip_ABCMark
                };
                miss_obj.Add(m);
                i++;
            }

            string str = JsonConvert.SerializeObject(miss_obj);

            return("{" + "\"data\": " + str + "}");
        }
Example #15
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         HttpContext.Current.Session.Clear();
         HttpContext.Current.Session.Remove("UserId");
         HttpContext.Current.Session.Remove("UserName");
         HttpContext.Current.Session.Remove("RoleId");
         HttpContext.Current.Session.Remove("RoleName");
         Helper.BindDropDownList(this.ddlRole, WorkFlows.GetSysRole(), "RoleName", "ID", true, "请选择系统角色", "0");
     }
 }
Example #16
0
        public static List <UI_WF_Define> ListAllWFDefine()
        {
            WorkFlows wfs = new WorkFlows();

            List <UI_WF_Define>    ui_wfs = new List <UI_WF_Define>();
            List <WorkFlow_Define> wds    = wfs.GetAllWorkFlows();

            wds.ForEach(s => ui_wfs.Add(new UI_WF_Define {
                wf_id = s.W_ID, wf_name = s.W_Name, wf_description = s.W_Attribution
            }));

            return(ui_wfs);
        }
Example #17
0
        // GET: /A7dot1dot1/机动处确认
        public void createA13dot1(string from_wfe_id)
        {
            //create new flow A13.1
            UI_MISSION miss           = CWFEngine.GetActiveMission <Person_Info>(Convert.ToInt32(from_wfe_id), ((IObjectContextAdapter)(new EquipWebContext())).ObjectContext);
            string     th_problem     = Convert.ToString(miss.Miss_Params["Th_ProblemRecords"]);
            JArray     j_Problem_data = JArray.Parse(th_problem);

            for (int i = 0; i < j_Problem_data.Count; i++)
            {
                JObject j_obj            = JObject.Parse(j_Problem_data[i].ToString());
                string  problem_catalogy = j_obj["problem_catalogy"].ToString();
                string  problem_detail   = j_obj["problem_detail"].ToString();
                //将7.1.1的串号赋给新产生的13.1的工作流
                WorkFlows          wfsd       = new WorkFlows();
                WorkFlow_Entity    wfecurrent = wfsd.GetWorkFlowEntity(Convert.ToInt32(from_wfe_id));
                UI_WorkFlow_Entity wfe        = CWFEngine.CreateAWFEntityByName("A13dot1", wfecurrent.WE_Ser);

                if (wfe != null)
                {
                    Dictionary <string, string> record = wfe.GetRecordItems();
                    record["username"] = (Session["User"] as EquipModel.Entities.Person_Info).Person_Name;
                    record["time"]     = DateTime.Now.ToString();
                    wfe.Start(record);
                    int flow_id = wfe.EntityID;
                    Dictionary <string, string> signal1 = new Dictionary <string, string>();
                    signal1["start_done"] = "true";
                    CWFEngine.SubmitSignal(flow_id, signal1, record);
                    //paras
                    Dictionary <string, string> signal = new Dictionary <string, string>();
                    signal["ZzSubmit_done"]        = "true";
                    signal["Cj_Name"]              = miss.Miss_Params["Cj_Name"].ToString();
                    signal["Zz_Name"]              = miss.Miss_Params["Zz_Name"].ToString();
                    signal["Equip_GyCode"]         = miss.Miss_Params["Equip_GyCode"].ToString();
                    signal["Equip_Code"]           = miss.Miss_Params["Equip_Code"].ToString();
                    signal["Equip_Type"]           = miss.Miss_Params["Equip_Type"].ToString();
                    signal["Problem_Desc"]         = problem_detail;
                    signal["Problem_DescFilePath"] = "";
                    signal["Zy_Type"]              = problem_catalogy;
                    signal["Zy_SubType"]           = miss.Miss_Params["Zy_SubType"].ToString();
                    signal["Equip_ABCMark"]        = miss.Miss_Params["Equip_ABCMark"].ToString();
                    signal["Data_Src"]             = "特护记录";

                    //submit
                    //record
                    //record["username"] = (Session["User"] as EquipModel.Entities.Person_Info).Person_Name;
                    record["time"] = DateTime.Now.ToString();
                    //submit
                    CWFEngine.SubmitSignal(flow_id, signal, record);
                }
            }
        }
Example #18
0
        public static CWorkFlow CreateWFEntityModifiedTimeOut(string wf_name, string event_name, CTimeOutProperty property, string Ser_Num = null /*2016/2/12--保证子工作流串号与父工作流相同*/)
        {
            CWorkFlow wf = new CWorkFlow();

            WorkFlows wfs = new WorkFlows();

            XmlDocument     doc    = new XmlDocument();
            WorkFlow_Define define = wfs.GetWorkFlowDefine(wf_name);

            doc.LoadXml(Encoding.Default.GetString(define.W_Xml));
            wf.InstFromXmlNode((XmlNode)doc.DocumentElement);

            //修改wf
            IEvent           ev_target   = wf.events[event_name];
            CTimeOutProperty timeout_pro = ev_target.GetTimeOutProperty();

            timeout_pro.ExactTime  = property.ExactTime;
            timeout_pro.StartTime  = property.StartTime;
            timeout_pro.TimeOffset = property.TimeOffset;

            WorkFlow_Entity wfe = new WorkFlow_Entity();

            wfe.WE_Status = WE_STATUS.CREATED;
            wfe.WE_Binary = Encoding.Default.GetBytes(wf.WriteToXmlNode().OuterXml);

            if (Ser_Num == null)
            {
                wfe.WE_Ser = "";
            }
            else
            {
                wfe.WE_Ser = Ser_Num;
            }

            if (!wfs.AddWorkEntity(wf_name, wfe))
            {
                return(null);
            }

            wf.EntityID     = wfe.WE_Id;
            wf.EntitySerial = wfe.WE_Ser;
            wf.DefineID     = define.W_ID;



            wf.RegEventsTimeOut(true);

            return(wf);
        }
Example #19
0
        protected void InitFlowOpinion()
        {
            string AppInstanceID = Request.QueryString["AppInstanceID"] == null ? string.Empty : Request.QueryString["AppInstanceID"].ToString();

            if (!string.IsNullOrEmpty(AppInstanceID))
            {
                DataTable dt = WorkFlows.GetHrsLeaveOpinionListByAppInstanceID(AppInstanceID);
                Repeater1.DataSource = dt;
                Repeater1.DataBind();
            }
            else
            {
                Repeater1.DataSource = null;
                Repeater1.DataBind();
            }
        }
Example #20
0
        protected void InitFlowOpinion()
        {
            int AppInstanceID = Request.QueryString["AppInstanceID"] == null ? 0 : Helper.ConverToInt32(Request.QueryString["AppInstanceID"].ToString());

            if (AppInstanceID > 0)
            {
                DataTable dt = WorkFlows.GetBizAppFlow(string.Format(" and AppInstanceID={0}", AppInstanceID));
                Repeater1.DataSource = dt;
                Repeater1.DataBind();
            }
            else
            {
                Repeater1.DataSource = null;
                Repeater1.DataBind();
            }
        }
Example #21
0
        protected void InitFlowOpinion()
        {
            string AppInstanceID = Request.QueryString["AppInstanceID"] == null ? string.Empty : Request.QueryString["AppInstanceID"].ToString();

            if (!string.IsNullOrEmpty(AppInstanceID))
            {
                DataTable dt = WorkFlows.GetBizAppFlow(string.Format(" and AppInstanceID='{0}'", AppInstanceID));
                Repeater1.DataSource = dt;
                Repeater1.DataBind();
            }
            else
            {
                Repeater1.DataSource = null;
                Repeater1.DataBind();
            }
        }
Example #22
0
        /// <summary>
        /// 检查SubProcess的状态
        /// </summary>
        private void CheckSubEventStatus()
        {
            //如果当前状态是SubProcess, 则要检测子时间是否已经执行完毕,
            //若已经执行完毕,则需要将返回值从子事件中取回
            if (m_events[m_courrentEvent].GetType().Name == "CSubProcessEvent")
            {
                CSubProcessEvent subE = (CSubProcessEvent)(m_events[m_courrentEvent]);
                WorkFlows wfs = new WorkFlows();

                WorkFlow_Entity wfe = wfs.GetWorkFlowEntity(subE.WfEntityId);
                //自流程已执行完成
                if (wfe.WE_Status == WE_STATUS.DONE)
                {
                    CWorkFlow subWf = new CWorkFlow();
                    XmlDocument doc = new XmlDocument();
                    doc.LoadXml(Encoding.Default.GetString(wfs.GetWorkFlowEntity(subE.WfEntityId).WE_Binary));
                    subWf.InstFromXmlNode(doc.DocumentElement);
                    subWf.EntityID = subE.WfEntityId;

                    IEvent subEnd = subWf.GetCurrentEvent();
                    //将变量返回回来
                    foreach (var p in subE.m_paramsFrom)
                    {
                        subE.paramlist[p.Key].value = subEnd.paramlist[p.Value].value;
                    }
                    //若子工作流的工作方式为串行, 则父工作流在子流程完成后继续向下执行
                    if (subE.WorkingMode == "serial")
                    {
                        StateTransfer("");
                        if (m_events[m_courrentEvent].GetType().Name == "CEndEvent")
                        {
                            //将该工作流置为已完成(结束)
                            UpdateEntity(WE_STATUS.DONE);
                            //2016.1.3 添加子事件返回

                        }
                        else
                            //更新工作流到数据库,不改变状态
                            UpdateEntity(WE_STATUS.INVALID);
                    }
                }


            }
        }
Example #23
0
        /// <summary>
        /// 获取某一工作流实体的历史任务
        /// </summary>
        /// <param name="entity_id">工作流实体ID</param>
        /// <returns></returns>
        public static List <UI_MISSION> GetHistoryMissions(int entity_id)
        {
            List <UI_MISSION> his_miss = new List <UI_MISSION>();

            WorkFlows      wfs     = new WorkFlows();
            List <Mission> db_miss = wfs.GetWFEntityMissions(entity_id);

            WorkFlow_Entity wfe = wfs.GetWorkFlowEntity(entity_id);
            //恢复工作流实体
            CWorkFlow   wf  = new CWorkFlow();
            XmlDocument doc = new XmlDocument();

            doc.LoadXml(Encoding.Default.GetString(wfe.WE_Binary));
            wf.EntityID = wfe.WE_Id;
            wf.InstFromXmlNode(doc.DocumentElement);


            foreach (var mi in db_miss)
            {
                UI_MISSION ui_mi = new UI_MISSION();
                ui_mi.WE_Entity_Id  = entity_id;
                ui_mi.WE_Entity_Ser = wfe.WE_Ser;
                ui_mi.WE_Event_Desc = mi.Miss_Desc;
                ui_mi.WE_Event_Name = mi.Event_Name;
                ui_mi.WE_Name       = mi.Miss_Name;
                ui_mi.Mission_Url   = ""; //历史任务的页面至空
                ui_mi.Miss_Id       = mi.Miss_Id;

                List <Mission_Param> mis_pars = wfs.GetMissParams(mi.Miss_Id);
                foreach (var par in mis_pars)
                {
                    CParam cp = new CParam();
                    cp.type                          = par.Param_Type;
                    cp.name                          = par.Param_Name;
                    cp.value                         = par.Param_Value;
                    cp.description                   = par.Param_Desc;
                    ui_mi.Miss_Params[cp.name]       = cp.value;
                    ui_mi.Miss_ParamsAppRes[cp.name] = wf.paramstable[cp.name].linkEventsApp_res[ui_mi.WE_Event_Name];
                    ui_mi.Miss_ParamsDesc[cp.name]   = cp.description;//xwm modified
                }
                his_miss.Add(ui_mi);
            }
            return(his_miss);
        }
Example #24
0
 /// <summary>
 /// 执行设置工作流实体状态的工作
 /// </summary>
 protected override void __processing()
 {
     try
     {
         //更新工作流实体的状态
         WorkFlows wfs = new WorkFlows();
         wfs.UpdateWorkFlowEntity(m_wfentityID, "WE_Status", m_run_params);
         //如果要改变的状态为ACTIVE, 则发送一个空消息,推动工作流运转
         if (((WE_STATUS)m_run_params) == WE_STATUS.ACTIVE)
         {
             CWFEngine.SubmitSignal(m_wfentityID, new Dictionary <string, string>(), null);
         }
     }
     catch
     {
         string error = string.Format("Set workflow entity {0} error!", m_wfentityID);
         Trace.WriteLine(error);
     }
 }
Example #25
0
        //工作流开始运行
        public string Start(IDictionary<string, string> record)
        {
            IEvent startE = null;
            foreach(var item in m_events)
            {
                if (item.Value.GetType().Name == "CStartEvent")
                {
                    startE = item.Value;
                    break;
                }
            }
            if (startE == null)
                return null;
            m_courrentEvent = startE.name;
            startE.EnterEvent("");
            UpdateEntity(WE_STATUS.ACTIVE);
            SubmitSignal("[]");

            //状态发生了迁移
            if (GetCurrentState() != startE.name)
            {
                if (record != null)
                {
                    WorkFlows wfs = new WorkFlows();
                    Mission ms = wfs.GetWFEntityLastMission(EntityID);

                    List<Process_Record> res = new List<Process_Record>();
                    foreach (var re in record)
                    {
                        if (GetRecordItems().ContainsKey(re.Key))
                        {
                            Process_Record pre = new Process_Record();
                            pre.Re_Name = re.Key;
                            pre.Re_Value = re.Value;
                            res.Add(pre);
                        }
                    }
                    wfs.LinkRecordInfoToMiss(ms.Miss_Id, res);
                }
            }            
            
            return m_events[m_courrentEvent].currentaction + @"/?wfe_id=" + m_entityID;
        }
Example #26
0
        //fhp添加方法开始----

        public static UI_WFEntity_Info GetMainWorkFlowEntity(string wfe_ser)
        {
            UI_WFEntity_Info wfe  = new UI_WFEntity_Info();
            WorkFlows        wfs  = new WorkFlows();
            WorkFlow_Entity  wfe1 = wfs.GetMainWorkFlowEntity(wfe_ser);

            CWorkFlow   wf  = new CWorkFlow();
            XmlDocument doc = new XmlDocument();

            doc.LoadXml(Encoding.Default.GetString(wfe1.WE_Binary));
            wf.InstFromXmlNode(doc.DocumentElement);
            wfe.description = wf.description;
            wfe.name        = wf.name;

            wfe.EntityID = wfe1.WE_Id;
            wfe.serial   = wfe1.WE_Ser;
            wfe.Status   = wfe1.WE_Status;
            return(wfe);
        }
Example #27
0
        /// <summary>
        /// 从数据库记录加载类对象
        /// </summary>
        /// <param name="job">数据库记录</param>
        public override void Load(Timer_Jobs job)
        {
            //加载工作流定义
            WorkFlows       wfs       = new WorkFlows();
            WorkFlow_Define wf_define = wfs.GetWorkFlowDefineByID(job.workflow_ID);

            m_workFlow = null;
            if (wf_define != null)
            {
                XmlDocument doc = new XmlDocument();
                doc.LoadXml(Encoding.Default.GetString(wf_define.W_Xml));
                m_workFlow = new CWorkFlow();
                m_workFlow.InstFromXmlNode((XmlNode)doc.DocumentElement);
                m_workFlow.DefineID = job.workflow_ID;
            }

            base.Load(job);

            CreateCallback = CustomAction;
        }
Example #28
0
        //获取当前任务列表

        /*public static List<UI_MISSION> GetActiveMissions<T>(ObjectContext oc, string Entity_name="ALL", bool bAuthCheck = true)
         * {
         *  List<UI_MISSION> missions = new List<UI_MISSION>();
         *
         *  WorkFlows wfs = new WorkFlows();
         *  List<WorkFlow_Entity> wfes = wfs.GetActiveWorkFlowEntities(Entity_name);
         *
         *  foreach(WorkFlow_Entity wfe in wfes)
         *  {
         *
         *
         *      UI_MISSION mi = new UI_MISSION();
         *      mi.WE_Entity_Id = wfe.WE_Id;
         *      mi.WE_Name = wfs.GetWorkFlowEntityName(wfe.WE_Id);
         *
         *      //恢复工作流实体
         *      CWorkFlow wf = new CWorkFlow();
         *      XmlDocument doc = new XmlDocument();
         *      doc.LoadXml(Encoding.Default.GetString(wfe.WE_Binary));
         *      wf.InstFromXmlNode(doc.DocumentElement);
         *      wf.EntityID = wfe.WE_Id;
         *      wf.EntitySerial = wfe.WE_Ser;
         *
         *      //if (wf.CurrentEventLink() == "")
         *      //    continue;
         *
         *      //权限验证
         *      if (bAuthCheck)
         *      {
         *          IEvent ev = wf.GetCurrentEvent();
         *          if (!ev.CheckAuthority<T>(authority_params, oc))
         *              continue;
         *      }
         *
         *
         *      mi.WE_Event_Name = wf.GetCurrentEvent().name;
         *      mi.WE_Event_Desc = wf.GetCurrentEvent().description;
         *      mi.Mission_Url = wf.CurrentEventLink();
         *      //读取参数的值
         *      foreach(var pa in wf.GetCurrentEvent().paramlist)
         *      {
         *          mi.Miss_Params[pa.Key] = pa.Value.value;
         *      }
         *
         *      missions.Add(mi);
         *  }
         *  return missions;
         * }*/
        public static List <UI_MISSION> GetActiveMissions <T>(ObjectContext oc, string Entity_name = "ALL", bool bAuthCheck = true)
        {
            List <UI_MISSION> missions = new List <UI_MISSION>();

            WorkFlows           wfs  = new WorkFlows();
            List <CURR_Mission> cMis = wfs.GetActiveMissionsOfEntity(Entity_name);

            foreach (CURR_Mission cm in cMis)
            {
                UI_MISSION mi = new UI_MISSION();
                mi.WE_Entity_Id = cm.WFE_ID;


                //if (wf.CurrentEventLink() == "")
                //    continue;

                //权限验证
                if (bAuthCheck)
                {
                    CAuthority author = new CAuthority();
                    author.auth_string = cm.Str_Authority;

                    //if (!author.CheckAuth<T>(new Dictionary<string, object>(), authority_params[HttpContext.Current.Session.SessionID], oc))
                    //    continue;
                    if (!author.CheckAuth <T>(new Dictionary <string, object>(), (Dictionary <string, object>)HttpContext.Current.Session[authority_params], oc))
                    {
                        continue;
                    }
                }


                mi.WE_Event_Name = cm.Miss_Name;
                mi.WE_Event_Desc = cm.Miss_Desc;
                mi.Mission_Url   = cm.Current_Action + @"/?wfe_id=" + mi.WE_Entity_Id;
                mi.WE_Event_Desc = cm.Miss_Desc;


                missions.Add(mi);
            }
            return(missions);
        }
Example #29
0
        //获得工作流实体的当前任务
        public static UI_MISSION GetActiveMission <T>(int entity_id, ObjectContext oc, bool bAuthCheck = true)
        {
            UI_MISSION miss = new UI_MISSION();

            WorkFlows wfs = new WorkFlows();

            WorkFlow_Entity wfe = wfs.GetWorkFlowEntity(entity_id);

            miss.WE_Entity_Id  = wfe.WE_Id;
            miss.WE_Name       = wfs.GetWorkFlowEntityName(wfe.WE_Id);
            miss.WE_Entity_Ser = wfe.WE_Ser;

            //恢复工作流实体
            CWorkFlow   wf  = new CWorkFlow();
            XmlDocument doc = new XmlDocument();

            doc.LoadXml(Encoding.Default.GetString(wfe.WE_Binary));
            wf.InstFromXmlNode(doc.DocumentElement);
            wf.EntityID = wfe.WE_Id;
            //权限验证
            if (bAuthCheck)
            {
                IEvent ev = wf.GetCurrentEvent();
                if (!ev.CheckAuthority <T>((Dictionary <string, object>)HttpContext.Current.Session[authority_params], oc))
                {
                    return(null);
                }
            }

            miss.WE_Event_Name = wf.GetCurrentEvent().name;
            miss.WE_Event_Desc = wf.GetCurrentEvent().description;
            miss.Mission_Url   = wf.CurrentEventLink();
            //读取参数的值
            foreach (var pa in wf.GetCurrentEvent().paramlist)
            {
                miss.Miss_Params[pa.Key]       = pa.Value.value;
                miss.Miss_ParamsAppRes[pa.Key] = wf.GetCurrentEvent().paramsApp_res[pa.Key];
            }

            return(miss);
        }
Example #30
0
        public IDictionary <string, PerformerList> NextActivityPerformers(string nextActivityPerformers)
        {
            IDictionary <string, PerformerList> nextActivityPerformersDictionary = new Dictionary <string, PerformerList>();

            string[] array = nextActivityPerformers.Split(',');
            foreach (string items in array)
            {
                string stepId = GetValueOfNodeIdList(items, "step");
                if (!string.IsNullOrWhiteSpace(stepId) && stepId != "0")
                {
                    string userId = GetValueOfNodeIdList(items, "member");

                    Performer performer = null;
                    if (!string.IsNullOrWhiteSpace(userId) && userId != "0" && userId.Length > 0)
                    {
                        SysUserEntity userEntity = WorkFlows.GetSysUserModel(Convert.ToInt32(userId));
                        if (userEntity != null && userEntity.ID > 0)
                        {
                            performer = new Performer(userId, userEntity.UserName);
                        }
                    }
                    if (performer == null)
                    {
                        performer = new Performer("0", string.Empty);
                    }

                    if (nextActivityPerformersDictionary.ContainsKey(stepId))
                    {
                        (nextActivityPerformersDictionary[stepId]).Add(performer);
                    }
                    else
                    {
                        PerformerList pList = new PerformerList();
                        pList.Add(performer);
                        nextActivityPerformersDictionary.Add(stepId, pList);
                    }
                }
            }
            return(nextActivityPerformersDictionary);
        }