Beispiel #1
0
 public VideoService(IUnitwork work)
 {
     _work    = work;
     Unitwork = work;
     _rpsv    = work.Repository <Basic_Vedio>();
     _rpsvs   = work.Repository <Basic_VedioSubject>();
 }
Beispiel #2
0
 public OpreateBillService(IUnitwork work, IFlow flow) : base(work, flow)
 {
     _work          = work;
     rpsOpreateBill = work.Repository <Bll_OpreationBill>();
     rpsBillFlow    = work.Repository <Bll_OpreateionBillFlow>();
     Unitwork       = work;
 }
        /// <summary>
        /// 根据作业ID,删除作业
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ActionResult <bool> DelOpreation(Guid id)
        {
            try
            {
                var dbopreation = _rpsopreation.GetModel(id);
                if (dbopreation == null)
                {
                    throw new Exception("该操作不存在!");
                }
                //作业务检查
                var check = _work.Repository <Bll_OpreationBill>().Any(p => p.OpreationID == dbopreation.ID);
                if (check)
                {
                    throw new Exception("该作业已用于作业申请单据,无法删除!");
                }
                _rpsopreation.Delete(dbopreation);
                //删除自定义项
                usedefinedService.DeleteBusinessValue(id);

                _work.Commit();
                return(new ActionResult <bool>(true));
            }
            catch (Exception ex)
            {
                return(new ActionResult <bool>(ex));
            }
        }
Beispiel #4
0
 public DocSolutionService(IUnitwork work)
 {
     _work    = work;
     Unitwork = work;
     _rpsds   = work.Repository <Doc_Solution>();
     _rpsdict = work.Repository <Core.Model.DB.Basic_Dict>();
 }
 public SafetyStandardService(IUnitwork work)
 {
     _work              = work;
     Unitwork           = work;
     _rpssafetystandard = work.Repository <Basic_SafetyStandard>();
     _rpsdangersort     = work.Repository <Basic_DangerSort>();
     _rpsdssd           = work.Repository <Basic_DangerSafetyStandards>();
 }
Beispiel #6
0
 public DangerSetService(IUnitwork work)
 {
     _work = work;
     Unitwork = work;
     _rpsdangerrelation = work.Repository<Basic_DangerRelation>();
     _rpsdanger = work.Repository<Basic_Danger>();
     _rpsdangersort = work.Repository<Basic_DangerSort>();
 }
Beispiel #7
0
 public DangerPointService(IUnitwork _work, IAttachFile file, ITree orgTree)
 {
     work     = _work;
     Unitwork = _work;
     rpsdp    = work.Repository <Basic_DangerPoint>();
     rpsdpr   = work.Repository <Basic_DangerPointRelation>();
     srvFile  = file;
     srvTree  = orgTree;
 }
Beispiel #8
0
 public HealDocmentService(IUnitwork work, IAttachFile file, IUserDefined userDefined)
 {
     _work          = work;
     Unitwork       = work;
     _rpshd         = work.Repository <Heal_Docment>();
     _rpsemp        = work.Repository <Core.Model.DB.Basic_Employee>();
     srvFile        = file;
     srvUserDefined = userDefined;
 }
 public OpreationFlowService(IUnitwork work, IUserDefined udf)
 {
     _work             = work;
     Unitwork          = work;
     _rpsopreation     = work.Repository <Basic_Opreation>();
     _rpsof            = work.Repository <Basic_OpreationFlow>();
     _rpspost          = work.Repository <Basic_Post>();
     usedefinedService = udf;
 }
Beispiel #10
0
 public DangerManageService(IUnitwork work, ITree tree)
 {
     _work                     = work;
     Unitwork                  = work;
     _rpsdanger                = work.Repository <Basic_Danger>();
     _rpsdangersort            = work.Repository <Basic_DangerSort>();
     _rpsdangersafetystandards = work.Repository <Basic_DangerSafetyStandards>();
     _rpsdr                    = work.Repository <Basic_DangerRelation>();
     srvTree                   = tree;
 }
 public DocTrainManageService(IUnitwork work, IAttachFile file)
 {
     _work     = work;
     Unitwork  = work;
     _rpsdt    = work.Repository <Doc_Training>();
     _rpsdtemp = work.Repository <Doc_TrainEmpoyees>();
     _rpsemp   = work.Repository <Core.Model.DB.Basic_Employee>();
     _rpsorg   = work.Repository <Core.Model.DB.Basic_Org>();
     srvFile   = file;
 }
Beispiel #12
0
 public FacilitiesManageService(IUnitwork work, IUserDefined usf, ITree tree, IAttachFile file)
 {
     _work              = work;
     Unitwork           = work;
     _rpsfacilitiessort = work.Repository <Basic_FacilitiesSort>();
     _rpsfacilities     = work.Repository <Basic_Facilities>();
     usedefinedService  = usf;
     srvTree            = tree;
     srvFile            = file;
 }
Beispiel #13
0
 public PostManageService(IUnitwork work, IUserDefined udf, IAttachFile file)
 {
     _work             = work;
     Unitwork          = work;
     _rpspost          = work.Repository <Basic_Post>();
     _rpspostemp       = work.Repository <Basic_PostEmployees>();
     _rpsemp           = work.Repository <Core.Model.DB.Basic_Employee>();
     _rpsorg           = work.Repository <Core.Model.DB.Basic_Org>();
     usedefinedService = udf;
     srvFile           = file;
 }
 public DocCertificateService(IUnitwork work, IAttachFile file)
 {
     _work    = work;
     Unitwork = work;
     _rpsdc   = work.Repository <Doc_Certificate>();
     srvFile  = file;
 }
 public DocInstitutionService(IUnitwork work, IUserDefined defined)
 {
     _work          = work;
     Unitwork       = work;
     _rpsin         = work.Repository <Doc_Institution>();
     srvUserDefined = defined;
 }
        /// <summary>
        /// 根据风险类别ID获取所有安全准则
        /// </summary>
        /// <param name="dangerid"></param>
        /// <returns></returns>
        public ActionResult <IEnumerable <SafetyStandardView> > GetSafetyStandards(Guid dangerid)
        {
            try
            {
                var SafetyStandardIds = _rpsdssd.Queryable(p => p.DangerID == dangerid).Select(s => s.SafetyStandardID);
                var ss     = _rpssafetystandard.Queryable(p => SafetyStandardIds.Contains(p.ID));
                var danger = _work.Repository <Basic_Danger>().GetModel(dangerid);
                var ds     = _rpsdangersort.GetModel(p => p.ID == danger.DangerSortID);

                var re = from o in ss
                         select new SafetyStandardView
                {
                    ID           = o.ID,
                    Code         = o.Code,
                    Controls     = o.Controls,
                    DangerSort   = ds.SortName,
                    DangerSortID = o.DangerSortID,
                    Name         = o.Name,
                    DangerName   = danger.Name
                };
                return(new ActionResult <IEnumerable <SafetyStandardView> >(re));
            }
            catch (Exception ex)
            {
                return(new ActionResult <IEnumerable <SafetyStandardView> >(ex));
            }
        }
Beispiel #17
0
 public DocMeetingService(IUnitwork work, IAttachFile file, IUserDefined userDefined)
 {
     _work          = work;
     Unitwork       = work;
     _rpsdm         = work.Repository <Doc_Meeting>();
     srvFile        = file;
     srvUserDefined = userDefined;
 }
Beispiel #18
0
 /// <summary>
 /// 根据指定Id获取风险项
 /// </summary>
 /// <param name="dangerid"></param>
 /// <returns></returns>
 public ActionResult <DangerView> GetDanger(Guid dangerid)
 {
     try
     {
         var dbdanger = _rpsdanger.GetModel(dangerid);
         if (dbdanger == null)
         {
             throw new Exception("未找到该风险信息");
         }
         var re = dbdanger.MAPTO <DangerView>();
         re.DangerSortName = _rpsdangersort.GetModel(dbdanger.DangerSortID).SortName;
         var dict = _work.Repository <Core.Model.DB.Basic_Dict>().GetModel(dbdanger.DangerLevel);
         re.DangerLevelName = dict == null ? "" : dict.DictName;
         return(new ActionResult <DangerView>(re));
     }
     catch (Exception ex)
     {
         return(new ActionResult <DangerView>(ex));
     }
 }
Beispiel #19
0
        /// <summary>
        /// 根据类别ID分页获取设备设施
        /// </summary>
        /// <param name="para"></param>
        /// <returns></returns>
        public ActionResult <Pager <FacilityView> > GetFacilities(PagerQuery <FacilitiesQuery> para)
        {
            try
            {
                var dbfacilities = _rpsfacilities.Queryable(p => p.SortID == para.Query.ID && (p.Name.Contains(para.KeyWord) || p.Code.Contains(para.KeyWord) || string.IsNullOrEmpty(para.KeyWord)));
                var sortname     = _rpsfacilitiessort.GetModel(p => p.ID == para.Query.ID).SortName;
                var orgids       = dbfacilities.Select(s => s.OrgID);

                var orgs    = _work.Repository <Core.Model.DB.Basic_Org>().Queryable(p => orgids.Contains(p.ID));
                var refclty = from f in dbfacilities
                              let org = orgs.FirstOrDefault(p => p.ID == f.OrgID)
                                        orderby f.Code, f.Code.Length
                    select new FacilityView
                {
                    ID           = f.ID,
                    Code         = f.Code,
                    Name         = f.Name,
                    Principal    = f.Principal,
                    PrincipalTel = f.PrincipalTel,
                    SortID       = f.SortID,
                    SortName     = sortname,
                    OrgName      = org.OrgName,
                    OrgID        = f.OrgID
                };

                string excel = "";
                if (para.ToExcel)
                {
                    var sw = from f in dbfacilities
                             let org = orgs.FirstOrDefault(p => p.ID == f.OrgID)
                                       orderby f.Code ascending
                                       select new
                    {
                        编号   = f.Code,
                        设备名称 = f.Name,
                        设备类别 = sortname,
                        使用单位 = org.OrgName,
                    };
                    excel = Command.CreateExcel(sw.AsEnumerable(), AppUser.OutPutPaht);
                }

                var re = new Pager <FacilityView>().GetCurrentPage(refclty, para.PageSize, para.PageIndex);
                re.ExcelResult = excel;
                return(new ActionResult <Pager <FacilityView> >(re));
            }
            catch (Exception ex)
            {
                return(new ActionResult <Pager <FacilityView> >(ex));
            }
        }
        public ActionResult <PhoneDocInstitutionModelView> GetDocInstitution(Guid id)
        {
            try
            {
                var dbins = _rpsin.GetModel(id);

                var dicts = _work.Repository <Core.Model.DB.Basic_Dict>().GetModel(dbins.TypeID);
                var re    = new PhoneDocInstitutionModelView
                {
                    BigCode         = dbins.BigCode,
                    InstitutionID   = dbins.ID,
                    IssueDate       = "发布日期:" + dbins.IssueDate.ToString("yyyy-MM-dd"),
                    InstitutionType = dicts.DictName,
                    Name            = dbins.Name,
                    Content         = dbins.Content
                };

                return(new ActionResult <PhoneDocInstitutionModelView>(re));
            }
            catch (Exception ex)
            {
                return(new ActionResult <PhoneDocInstitutionModelView>(ex));
            }
        }
Beispiel #21
0
        /// <summary>
        /// 删除人员的健康档案
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ActionResult <bool> DelHealDocment(Guid id)
        {
            try
            {
                var dbhd = _rpshd.GetModel(id);
                if (dbhd == null)
                {
                    throw new Exception("未找到所要删除的人员健康档案");
                }
                _rpshd.Delete(dbhd);

                _work.Repository <Heal_Records>().Delete(p => p.DocmentID == id);
                //删除电子文档
                srvFile.DelFileByBusinessId(id);
                //删除自定义项
                srvUserDefined.DeleteBusinessValue(id);
                _work.Commit();
                return(new ActionResult <bool>(true));
            }
            catch (Exception ex)
            {
                return(new ActionResult <bool>(ex));
            }
        }
Beispiel #22
0
        /// <summary>
        /// 获取摄像头的信息
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ActionResult <VideoModelView> GetVideo(Guid id)
        {
            try
            {
                var dbv = _rpsv.GetModel(id);
                if (dbv == null)
                {
                    throw new Exception("摄像头未找到");
                }
                var rev = dbv.MAPTO <VideoModelView>();

                var subs   = _rpsvs.Queryable(q => q.VedioID == id).ToList();
                var subids = subs.Select(s => s.SubjectID);

                var devs  = _work.Repository <Basic_Facilities>().Queryable(q => subids.Contains(q.ID)).ToList();
                var posts = _work.Repository <Basic_Post>().Queryable(q => subids.Contains(q.ID)).ToList();
                var opres = _work.Repository <Basic_Opreation>().Queryable(q => subids.Contains(q.ID)).ToList();

                rev.Subjects                                                                                              = from s in subs
                                                              let dev                                                     = devs.FirstOrDefault(q => q.ID == s.SubjectID)
                                                                                             let ppst                     = posts.FirstOrDefault(q => q.ID == s.SubjectID)
                                                                                                                  let opr = opres.FirstOrDefault(q => q.ID == s.SubjectID)
                                                                                                                            select new VideoSubjectView
                {
                    ID              = s.ID,
                    VedioID         = s.VedioID,
                    SubjectID       = s.SubjectID,
                    SubjectType     = s.SubjectType,
                    SubjectTypeName = Command.GetItems(typeof(PublicEnum.EE_SubjectType)).FirstOrDefault(q => q.Value == s.SubjectType).Caption,
                    SubjectName     =
                        dev != null ? dev.Name : ppst != null ? ppst.Name : opr != null ? opr.Name : default(string)
                };
                return(new ActionResult <VideoModelView>(rev));
            }
            catch (Exception ex)
            {
                return(new ActionResult <VideoModelView>(ex));
            }
        }
Beispiel #23
0
        /// <summary>
        /// 微信解绑
        /// </summary>
        /// <param name="openid"></param>
        /// <returns></returns>
        public override ActionResult <bool> UserWxUnBind(string openid)
        {
            var rpsbinds = _work.Repository <Core.Model.DB.Platform.Auth_WxBinds>();
            var wxbind   = rpsbinds.GetModel(q => q.openID == openid);

            if (wxbind == null)
            {
                throw new Exception("该用户尚未绑定微信");
            }
            var rpsact = _work.Repository <AccountInfo>();

            var act = rpsact.GetModel(q => q.AccountCode == wxbind.AccountCode);

            if (act == null)
            {
                throw new Exception("账套数据有误");
            }
            if (act.State == (int)PublicEnum.AccountState.Closed || act.ValidDate <= DateTime.Now)
            {
                throw new Exception("账套已经过期或已关闭");
            }
            //rpsbinds.Delete(wxbind);
            //_work.Commit();

            Core.Model.AppUserDB userdb = new AppUserDB()
            {
                DBName   = act.DBName,
                DBPwd    = act.DBPwd,
                DBServer = act.DBServer,
                DBUid    = act.DBUid
            };
            Unitwork.SetUserDB(userdb);

            var rpsuser = _work.Repository <Core.Model.DB.Auth_User>();
            var user    = rpsuser.GetModel(q => q.openID == openid);

            if (user == null)
            {
                throw new Exception("用户未绑定微信");
            }
            user.openID = "";
            rpsuser.Update(user);
            _work.Commit();

            return(base.UserWxUnBind(openid));
        }
Beispiel #24
0
 public AttachFileService(IUnitwork work)
 {
     _work    = work;
     Unitwork = work;
     rpsFile  = work.Repository <Bll_AttachFile>();
 }
Beispiel #25
0
        public ReportService(IUnitwork _work)
        {
            work       = _work;
            Unitwork   = _work;
            rpsDP      = _work.Repository <Basic_DangerPoint>();
            rpsEmp     = _work.Repository <Basic_Employee>();
            rpsDict    = _work.Repository <Basic_Dict>();
            rpsDPR     = _work.Repository <Basic_DangerPointRelation>();
            rpsDanger  = _work.Repository <Basic_Danger>();
            rpsOrg     = _work.Repository <Basic_Org>();
            rpsDR      = _work.Repository <Basic_DangerRelation>();
            rpsPost    = _work.Repository <Basic_Post>();
            rpsFile    = _work.Repository <Bll_AttachFile>();
            rpsOpreate = _work.Repository <Basic_Opreation>();
            rpsOF      = _work.Repository <Basic_OpreationFlow>();

            rpsTCtr = _work.Repository <Bll_TroubleControl>();
            rpsTCD  = _work.Repository <Bll_TroubleControlDetails>();
            rpsTCF  = _work.Repository <Bll_TroubleControlFlows>();
            rpsTS   = _work.Repository <Bll_InspectTaskSubject>();
            rpsTBS  = _work.Repository <Bll_TaskBillSubjects>();
            rpsTB   = _work.Repository <Bll_TaskBill>();
            rpsDSS  = _work.Repository <Basic_DangerSafetyStandards>();
            rpsSS   = _work.Repository <Basic_SafetyStandard>();
        }
Beispiel #26
0
 public DashboardService(IUnitwork _work)
 {
     work     = _work;
     Unitwork = _work;
     rpsDP    = _work.Repository <Basic_DangerPoint>();
 }
Beispiel #27
0
        /// <summary>
        /// 新建配置关系模型
        /// </summary>
        /// <param name="relationNew"></param>
        /// <returns></returns>
        public ActionResult <bool> AddDangerPointRelation(DangerPointRelationNew relationNew)
        {
            try
            {
                var dbdp = rpsdp.GetModel(q => q.ID == relationNew.DangerPointID);
                if (dbdp == null)
                {
                    throw new Exception("未找到该风险点");
                }
                var subids = relationNew.DSubs.Select(s => s.SubjectID);
                var check  = rpsdpr.Any(p => subids.Contains(p.SubjectID) && p.DangerPointID == relationNew.DangerPointID);
                if (check)
                {
                    throw new Exception("配置主体中有已存在的于风险点下的!");
                }
                check = work.Repository <Basic_DangerRelation>().Any(p => subids.Contains(p.SubjectID));
                if (!check)
                {
                    throw new Exception("配置主体中存在没有配置风控项的主体!");
                }
                //所有风控项ID
                var dangerids = work.Repository <Basic_DangerRelation>().Queryable(p => subids.Contains(p.SubjectID)).Select(s => s.DangerID);
                //所有风险等级ID
                var lvids = work.Repository <Basic_Danger>().Queryable(p => dangerids.Contains(p.ID)).Select(s => s.DangerLevel);
                //最大的风险等级具体项
                var lv = work.Repository <Core.Model.DB.Basic_Dict>().Queryable(p => lvids.Contains(p.ID)).OrderByDescending(o => o.MinValue).FirstOrDefault();

                var dplv = work.Repository <Core.Model.DB.Basic_Dict>().GetModel(p => p.ID == dbdp.DangerLevel);
                if (dplv.MinValue < lv.MinValue)
                {
                    //如果主体的风空项的风险等级大于预设的风险点的风险等级则更新预设的风险等级
                    dbdp.DangerLevel = lv.ID;
                    rpsdp.Update(dbdp);
                }
                var dbdpr = from dr in relationNew.DSubs
                            select new Basic_DangerPointRelation
                {
                    DangerPointID       = relationNew.DangerPointID,
                    SubjectID           = dr.SubjectID,
                    SubjectName         = dr.SubjectName,
                    SubjectPrincipal    = dr.SubjectPrincipal,
                    SubjectPrincipalTel = dr.SubjectPrincipalTel,
                    SubjectType         = dr.SubjectType
                };
                rpsdpr.Add(dbdpr);
                work.Commit();
                return(new ActionResult <bool>(true));
            }
            catch (Exception ex)
            {
                return(new ActionResult <bool>(ex));
            }
        }
Beispiel #28
0
 /// <summary>
 /// 获取风险等级的个数
 /// </summary>
 /// <returns></returns>
 public ActionResult <IEnumerable <DashDangerLevel> > GetDashDLevel()
 {
     try
     {
         var dls  = work.Repository <Core.Model.DB.Basic_Dict>().Queryable(p => p.ParentID == OptionConst.DangerLevel);
         var ctrs = work.Repository <Bll_TroubleControl>().Queryable(p => p.State < (int)PublicEnum.EE_TroubleState.over);
         var dps  = rpsDP.Queryable();
         var dpss = from dp in dps
                    let dlvs                                                    = ctrs.Where(p => p.DangerPoint == dp.ID).Select(s => s.DangerLevel)
                                                   let lv                       = dls.Where(p => dlvs.Contains(p.ID)).OrderByDescending(s => s.LECD_DMinValue).FirstOrDefault()
                                                                       let dplv = dls.FirstOrDefault(p => p.ID == dp.DangerLevel)
                                                                                  select new
         {
             Name             = dp.Name,
             Consequence      = dp.Consequence,
             ControlMeasure   = dp.ControlMeasure,
             EmergencyMeasure = dp.EmergencyMeasure,
             IsCtrl           = lv == null ? "否" : "是",
             DangerLevelID    = lv.LECD_DMinValue > dplv.LECD_DMinValue ? lv.ID : dp.DangerLevel,
         };
         var re = from dl in dls
                  let dpsss = dpss.Where(p => p.DangerLevelID == dl.ID)
                              orderby dl.LECD_DMinValue descending
                              select new DashDangerLevel
         {
             DPInfos = from dp in dpsss
                       select new DPInfo
             {
                 Name             = dp.Name,
                 Consequence      = dp.Consequence,
                 ControlMeasure   = dp.ControlMeasure,
                 EmergencyMeasure = dp.EmergencyMeasure,
                 IsCtrl           = dp.IsCtrl
             },
             Level = dl.DictName,
             Count = dpsss.Count(),
         };
         return(new ActionResult <IEnumerable <DashDangerLevel> >(re));
     }
     catch (Exception ex)
     {
         return(new ActionResult <IEnumerable <DashDangerLevel> >(ex));
     }
 }
Beispiel #29
0
        /// <summary>
        /// 新建作业申请单
        /// </summary>
        /// <param name="bill"></param>
        /// <returns></returns>
        public ActionResult <bool> AddNew(OperateBillNew bill)
        {
            try
            {
                var opreationmodel = _work.Repository <Core.Model.DB.Account.Basic_Opreation>().GetModel(bill.OpreationID);
                if (opreationmodel == null)
                {
                    throw new Exception("作业流程未找到");
                }

                var flows = _work.Repository <Core.Model.DB.Account.Basic_OpreationFlow>().Queryable(q => q.OpreationID == opreationmodel.ID).OrderBy(o => o.PointIndex).ToList();
                if (flows.Count() == 0)
                {
                    throw new Exception("该作业流程未配置流程节点,请配置!");
                }
                if (bill.PrincipalEmployeeID == Guid.Empty)
                {
                    throw new Exception("请选择作业流程负责人!");
                }
                var billdb = bill.MAPTO <Core.Model.DB.Account.Bll_OpreationBill>();
                billdb.BillCode      = Command.CreateCode();
                billdb.FlowsJson     = JsonConvert.SerializeObject(flows);
                billdb.OpreationJSON = JsonConvert.SerializeObject(opreationmodel);
                billdb.State         = (int)PublicEnum.BillFlowState.normal;
                billdb.CreateMan     = AppUser.EmployeeInfo.CNName;

                _work.Repository <Core.Model.DB.Account.Bll_OpreationBill>().Add(billdb);
                _work.Commit();

                return(new ActionResult <bool>(true));
            }
            catch (Exception ex)
            {
                return(new ActionResult <bool>(ex));
            }
        }