Beispiel #1
0
 /// <summary>
 /// 我的单据新增
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public bool AddPersonalRecordList(T_PF_PERSONALRECORD model)
 {
     try
     {
         PersonalRecordDAL dal      = new PersonalRecordDAL();
         string            recordID = dal.GetExistRecord(model.SYSTYPE, model.MODELCODE, model.MODELID, model.OWNERID, model.OWNERCOMPANYID, model.ISFORWARD);
         if (recordID != "")
         {
             return(dal.UpdatePersonalRecord(model, recordID));
         }
         else
         {
             var bol = dal.AddPersonalRecord(model);
             if (bol)
             {
                 PersonnelWS.PersonnelServiceClient HRClient = new PersonnelWS.PersonnelServiceClient();
                 var user = HRClient.GetEmployeeByID(model.OWNERID);
                 SendEmail("你有新的单据请登录系统查看!", user.EMAIL);
                 Log.WriteLog("FormID=" + model.MODELID + ";MODELDESCRIPTION=" + model.MODELDESCRIPTION + ";接收EMAIL=" + user.EMAIL + ";所属人ID=" + user.OWNERID);
             }
             return(bol);
         }
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message, ex);
     }
 }
Beispiel #2
0
 public BaseBll()
 {
     if (dal == null)
     {
         dal = new CommDAL <TEntity>();
     }
     if (personnelclient == null)
     {
         personnelclient = new PersonnelWS.PersonnelServiceClient();
     }
     if (Orgclinet == null)
     {
         Orgclinet = new BLLCommonServices.OrganizationWS.OrganizationServiceClient();
     }
     if (outInterfaceClient == null)
     {
         outInterfaceClient = new BLLCommonServices.WFPlatformWS.OutInterfaceClient();
     }
 }
Beispiel #3
0
        public void AddDoDask(string companyID, string orderID, string systemCode, string modelCode, string modelName, string strXML, MsgType msgType)
        {
            try
            {
                Tracer.Debug("传入参数:companyID||" + companyID + "||orderID:" + orderID + "||modelCode:" + modelCode + "||strXML:" + strXML);
                EngineServicesDAL dal = new EngineServicesDAL();
                T_WF_MESSAGEBODYDEFINE MsgBodyDefine = dal.GetMessageBodyDefine(systemCode, modelCode, companyID, 0).FirstOrDefault();
                if (MsgBodyDefine == null)
                {
                    Tracer.Debug("EngineServicesBLL.AddDoDask()没有查询到默认消息:modelCode||" + modelCode + "||systemCode" + systemCode + "||companyID" + companyID);
                    return;
                }
                DataTable dtValue = Common.EncrytXmlToDataTable(strXML);
                string Content = MsgBodyDefine.MESSAGEBODY;
                string Url = MsgBodyDefine.MESSAGEURL;
                Tracer.Debug("查询到的URL:" + Url);
                Content = Content.Replace("new:", "");
                Common.ReplaceValue(ref Content, ref Url, dtValue);
                Tracer.Debug("替换后的URL:" + Url);
                //T_WF_DOTASK dask = new T_WF_DOTASK();
                if (MsgBodyDefine.RECEIVETYPE == 1 && MsgBodyDefine.RECEIVERUSERID != null)
                {
                    for (int i = 0; i < MsgBodyDefine.RECEIVERUSERID.Split(',').Length; i++)
                    {

                        if (MsgType.Task == msgType)//代办任务
                        {
                            TaskCache.TaskCacheReflesh(MsgBodyDefine.RECEIVERUSERID.Split(',')[i]);
                            dal.ClosedDoTaskStatus(systemCode, orderID, MsgBodyDefine.RECEIVERUSERID.Split(',')[i]);
                            Tracer.Debug("开始进行保存时的URL:" + Url);
                            dal.SendTriggerTaskMsg(MsgBodyDefine.RECEIVERUSERID.Split(',')[i], systemCode, modelCode, orderID, Content, Url, Common.BOObjectEscapeString(strXML), strXML);
                        }
                        else if (MsgType.Msg == msgType)
                        {
                            dal.SendTriggerMsg(MsgBodyDefine.RECEIVERUSERID.Split(',')[i], systemCode, orderID, Content);
                        }

                    }
                }
                else if (MsgBodyDefine.RECEIVETYPE == 0 && MsgBodyDefine.RECEIVEPOSTID != null)
                {
                    for (int i = 0; i < MsgBodyDefine.RECEIVEPOSTID.Split(',').Length; i++)
                    {

                        PersonnelWS.PersonnelServiceClient HRClient = new PersonnelWS.PersonnelServiceClient();
                        Tracer.Debug("岗位:" + MsgBodyDefine.RECEIVEPOSTID.Split(',')[i]);
                        if (!string.IsNullOrEmpty(MsgBodyDefine.RECEIVEPOSTID.Split(',')[i]))
                        {
                            string[] Employees = HRClient.GetEmployeeIDsByPostID(MsgBodyDefine.RECEIVEPOSTID.Split(',')[i]);
                            Tracer.Debug("岗位人:" + Employees[0]);
                            if (MsgType.Task == msgType)//代办任务
                            {
                                TaskCache.TaskCacheReflesh(Employees[0]);
                                dal.ClosedDoTaskStatus(systemCode, orderID, Employees[0]);
                                Tracer.Debug("开始进行保存时的URL:" + Url);
                                dal.SendTriggerTaskMsg(Employees[0], systemCode, modelCode, orderID, Content, Url, Common.BOObjectEscapeString(strXML), strXML);
                            }
                            else if (MsgType.Msg == msgType)
                            {
                                dal.SendTriggerMsg(Employees[0], systemCode, orderID, Content);
                            }
                        }

                    }
                }

            }
            catch (Exception ex)
            {
                Tracer.Debug("EngineServicesBLL.AddDoDask()" + ex.Message);
            }
        }
Beispiel #4
0
        private bool EngineExecute(T_WF_DOTASK Entity, string IsTask)
        {
            bool result = false;
            EngineServicesDAL dal = new EngineServicesDAL();
            string strAppFieldValue = string.Empty;
            DataTable sourceTable = Common.FieldStringToDataTable(Entity.APPFIELDVALUE, ref strAppFieldValue);//将业务数据与流程数据转换成DataTable作为替换的源数据
            //通过系统代号,模块代号,企业ID,流程状态查到引擎配置内容

            DataTable dtFlowTrigger = dal.FlowTriggerTable(Entity.SYSTEMCODE, Entity.MODELCODE, Entity.ORDERSTATUS.ToString(), Entity.COMPANYID);
            if (dtFlowTrigger != null && dtFlowTrigger.Rows.Count > 0)
            {
                #region
                DataRow[] drs = dtFlowTrigger.Select("ISDEFAULTMSG=1");//发的是默认流程触发条件
                if (drs.Count() > 0)
                {
                    if (IsTask == "1")//新增待办任务
                    {
                        TaskCache.TaskCacheReflesh(Entity.RECEIVEUSERID);
                        dal.AddDoTask(Entity, drs[0], sourceTable, strAppFieldValue);//新增待办任务
                    }
                    else if (IsTask == "0")//消息
                    {
                        dal.AddDoTaskMessage(Entity, drs[0], sourceTable);
                    }
                }
                DataRow[] NotDefaultMsg = dtFlowTrigger.Select("ISDEFAULTMSG=0");//非默认消息,需要调用的WCF待办任务
                if (NotDefaultMsg != null && NotDefaultMsg.Count() > 0)
                {
                    foreach (DataRow dr1 in NotDefaultMsg)
                    {
                        string strAppMsg = string.Empty;
                        CallWCFService(dr1, sourceTable, ref strAppMsg);//调用WCF服务
                        if (!string.IsNullOrEmpty(strAppMsg))
                        {
                            try
                            {
                                string IsNewFlow = "1";
                                string NewFormID = string.Empty;
                                string strFormTypes = string.Empty;//表单状态
                                DataRow DRNewTrigger = null;
                                if (ApplicationValueToDataTable(strAppMsg, string.Concat(Entity.COMPANYID), ref sourceTable, ref IsNewFlow, ref NewFormID, ref strFormTypes, ref DRNewTrigger))
                                {
                                    //通过岗位查找用户,并且取第一个用户为发送消息的对像
                                    PersonnelWS.PersonnelServiceClient HRClient = new PersonnelWS.PersonnelServiceClient();
                                    if (!string.IsNullOrEmpty(dr1["OWNERPOSTID"].ToString()))
                                    {
                                        string[] Employees = HRClient.GetEmployeeIDsByPostID(dr1["OWNERPOSTID"].ToString());
                                        if (Employees != null && Employees.Count() > 0)
                                        {
                                            TaskCache.TaskCacheReflesh(NewFormID);
                                            dal.AddDoTask(Entity, dr1, sourceTable, Employees[0], NewFormID, strAppFieldValue, string.Concat(dr1["MESSAGEBODY"]), strFormTypes);//发送消息
                                        }
                                    }
                                    else
                                    {
                                        result = false;
                                        Tracer.Debug("命名空间:SMT.Workflow.Engine.Services.BLL类方法:EngineExecute()引擎调用新流程时没有选定岗位");
                                    }
                                }
                            }
                            catch (Exception ex)
                            {
                                result = false;
                                Tracer.Debug("命名空间:SMT.Workflow.Engine.Services.BLL类方法:EngineExecute()" + ex.Message);
                            }
                        }
                    }
                }
                result = true;
                #endregion
            }
            else
            {

                string strMsg = "系统代号" + Entity.SYSTEMCODE + "\r\n" +
                                 "模块代号:" + Entity.MODELCODE + "\r\n" +
                                 "触发条件:" + Entity.ORDERSTATUS +
                                 "公司ID:" + Entity.COMPANYID + "\r\n" +
                                 "单据ID:" + Entity.ORDERID;
                Tracer.Debug("该单据所对应的引擎系统设置未找到,请先配置该模块引擎消息(审核通过、审核不通过、审核中)" + strMsg);
            }
            return result;
        }
Beispiel #5
0
        public List<UserInfo> ReturnUserInfoDask(string companyID, string orderID, string systemCode, string modelCode, string modelName, string strXML, MsgType msgType)
        {
            try
            {
                PersonnelWS.PersonnelServiceClient HRClient = new PersonnelWS.PersonnelServiceClient();
                List<UserInfo> list = new List<UserInfo>();
                EngineServicesDAL dal = new EngineServicesDAL();
                T_WF_MESSAGEBODYDEFINE MsgBodyDefine = dal.GetMessageBodyDefine(systemCode, modelCode, companyID, 0).FirstOrDefault();
                if (MsgBodyDefine == null)
                {
                    Tracer.Debug("EngineServicesBLL.ReturnUserInfoDask()没有查询到默认消息:modelCode||" + modelCode + "||systemCode" + systemCode + "||companyID" + companyID);
                    return null;
                }
                DataTable dtValue = Common.EncrytXmlToDataTable(strXML);
                string Content = MsgBodyDefine.MESSAGEBODY;
                string Url = MsgBodyDefine.MESSAGEURL.Replace("Details", "Edit");//MVC 审核通过之后发送指定人的代办
                Content = Content.Replace("new:", "");
                Common.ReplaceValue(ref Content, ref Url, dtValue);
                Tracer.Debug("替换后的URL:" + Url);
                if (MsgBodyDefine.RECEIVETYPE == 1 && MsgBodyDefine.RECEIVERUSERID != null)
                {
                    for (int i = 0; i < MsgBodyDefine.RECEIVERUSERID.Split(',').Length; i++)
                    {
                        var Users = HRClient.GetFlowUserByUserID(MsgBodyDefine.RECEIVERUSERID.Split(',')[i]);
                        UserInfo info = new UserInfo();
                        info.CompanyID = Users[0].CompayID;
                        info.CompanyName = Users[0].CompayName;
                        info.DepartmentID = Users[0].DepartmentID;
                        info.DepartmentName = Users[0].DepartmentName;
                        info.PostID = Users[0].PostID;
                        info.PostName = Users[0].PostName;
                        info.UserID = Users[0].UserID;
                        info.UserName = Users[0].EmployeeName;
                        list.Add(info);
                        if (MsgType.Task == msgType)//代办任务
                        {
                            TaskCache.TaskCacheReflesh(MsgBodyDefine.RECEIVERUSERID.Split(',')[i]);
                            dal.ClosedDoTaskStatus(systemCode, orderID, MsgBodyDefine.RECEIVERUSERID.Split(',')[i]);
                            Tracer.Debug("开始进行保存时的URL:" + Url);
                            dal.SendTriggerTaskMsg(MsgBodyDefine.RECEIVERUSERID.Split(',')[i], systemCode, modelCode, orderID, Content, Url, Common.BOObjectEscapeString(strXML), strXML);
                        }
                        else if (MsgType.Msg == msgType)
                        {
                            dal.SendTriggerMsg(MsgBodyDefine.RECEIVERUSERID.Split(',')[i], systemCode, orderID, Content);
                        }

                    }
                }
                else if (MsgBodyDefine.RECEIVETYPE == 0 && MsgBodyDefine.RECEIVEPOSTID != null)
                {
                    for (int i = 0; i < MsgBodyDefine.RECEIVEPOSTID.Split(',').Length; i++)
                    {
                        Tracer.Debug("岗位:" + MsgBodyDefine.RECEIVEPOSTID.Split(',')[i]);
                        if (!string.IsNullOrEmpty(MsgBodyDefine.RECEIVEPOSTID.Split(',')[i]))
                        {
                            string[] Employees = HRClient.GetEmployeeIDsByPostID(MsgBodyDefine.RECEIVEPOSTID.Split(',')[i]);
                            var Users = HRClient.GetFlowUserByUserID(Employees[0]);
                            UserInfo info = new UserInfo();
                            info.CompanyID = Users[0].CompayID;
                            info.CompanyName = Users[0].CompayName;
                            info.DepartmentID = Users[0].DepartmentID;
                            info.DepartmentName = Users[0].DepartmentName;
                            info.PostID = Users[0].PostID;
                            info.PostName = Users[0].PostName;
                            info.UserID = Users[0].UserID;
                            info.UserName = Users[0].EmployeeName;
                            list.Add(info);
                            Tracer.Debug("岗位人:" + Employees[0]);
                            if (MsgType.Task == msgType)//代办任务
                            {
                                TaskCache.TaskCacheReflesh(Employees[0]);
                                dal.ClosedDoTaskStatus(systemCode, orderID, Employees[0]);
                                Tracer.Debug("开始进行保存时的URL:" + Url);
                                dal.SendTriggerTaskMsg(Employees[0], systemCode, modelCode, orderID, Content, Url, Common.BOObjectEscapeString(strXML), strXML);
                            }
                            else if (MsgType.Msg == msgType)
                            {
                                dal.SendTriggerMsg(Employees[0], systemCode, orderID, Content);
                            }
                        }

                    }
                }
                return list;
            }
            catch (Exception ex)
            {
                Tracer.Debug("EngineServicesBLL.ReturnUserInfoDask()" + ex.Message);
                return null;
            }
        }
Beispiel #6
0
 /// <summary>
 /// 我的单据新增
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public bool AddPersonalRecordList(T_PF_PERSONALRECORD model)
 {
     try
     {
         PersonalRecordDAL dal = new PersonalRecordDAL();
         string recordID = dal.GetExistRecord(model.SYSTYPE, model.MODELCODE, model.MODELID, model.OWNERID, model.OWNERCOMPANYID, model.ISFORWARD);
         if (recordID != "")
         {
             return dal.UpdatePersonalRecord(model, recordID);
         }
         else
         {
             var bol= dal.AddPersonalRecord(model);
             if (bol)
             {
                  PersonnelWS.PersonnelServiceClient HRClient = new PersonnelWS.PersonnelServiceClient();
                  var user = HRClient.GetEmployeeByID(model.OWNERID);
                  SendEmail("你有新的单据请登录系统查看!", user.EMAIL);
                  Log.WriteLog("FormID=" + model.MODELID + ";MODELDESCRIPTION=" + model.MODELDESCRIPTION + ";接收EMAIL=" + user.EMAIL+";所属人ID="+user.OWNERID);
             }
             return bol;
         }
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message, ex);
     }
 }