Ejemplo n.º 1
0
        /// <summary>
        /// 给栏目绑定指标 页面
        /// </summary>
        /// <param name="keyValue">栏目Id</param>
        /// <param name="indexType">所属平台 0web平台 1安卓平台 2App</param>
        /// <param name="Templet">所属栏目</param>
        /// <returns></returns>
        public ActionResult TerminalBindForm(string keyValue, int indexType, int Templet)
        {
            Operator                     user       = OperatorProvider.Provider.Current();
            DepartmentEntity             userdept   = new DepartmentBLL().GetCompany(user.DeptId);
            TerminalDataSetBLL           dataSetBLL = new TerminalDataSetBLL();
            List <TerminalDataSetEntity> indexlist  = new List <TerminalDataSetEntity>();

            indexlist = dataSetBLL.GetList().Where(p => p.IsOpen == 1).ToList();
            //if (indexType == 2)
            //{
            //    indexlist = dataSetBLL.GetList().Where(p => p.IsOpen == 1 && (p.DataSetType == indexType.ToString() )).ToList(); //所有的手机APP指标
            //}
            //else
            //{
            //    indexlist = dataSetBLL.GetList().Where(p => p.IsOpen == 1 && (p.DataSetType == indexType.ToString() || p.DataSetType == null)).ToList(); //所有的终端指标
            //}

            //查询本IndexType的栏目
            var titleIds = manageBLL.GetList(userdept.DepartmentId, indexType).Where(x => x.Templet == Templet).Select(x => x.Id);
            //查找所有的关联关系
            IIndexAssocationBLL          indexAssocationBLL = new IIndexAssocationBLL();
            List <IndexAssocationEntity> indices            = indexAssocationBLL.GetListByTitleId(titleIds.ToArray());

            //先剔除非本IndexType的关联关系
            indices = indices.Where(x => titleIds.Contains(x.TitleId)).ToList();
            //查询未被其他标题绑定的指标
            var BindIds     = indices.Where(x => x.TitleId != keyValue).Select(p => p.DataSetId); //非当前标题 已经的被帮的指标
            var thisBindIds = indices.Where(x => x.TitleId == keyValue).Select(p => p.DataSetId); //当前标题绑定的指标
            var data        = indexlist.Where(x => !BindIds.Contains(x.Id)).ToList();             //当前标题 可显示的指标

            ViewBag.ChceckIds = thisBindIds.ToList();
            ViewBag.TitleId   = keyValue;
            return(View(data));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 获取终端指标配置实体
        /// </summary>
        /// <param name="keyValue"></param>
        /// <returns></returns>
        public ActionResult GetTerminalFormJson(string keyValue)
        {
            TerminalDataSetBLL bll = new TerminalDataSetBLL();
            var entity             = bll.GetEntity(keyValue);

            return(ToJsonResult(entity));
        }
Ejemplo n.º 3
0
 public ActionResult RemoveTerminalForm(string keyValue)
 {
     try
     {
         TerminalDataSetBLL bll = new TerminalDataSetBLL();
         bll.RemoveForm(keyValue);
         return(Success("删除成功。"));
     }
     catch (Exception ex)
     {
         return(Error(ex.Message));
     }
 }
Ejemplo n.º 4
0
 public ActionResult SaveTerminalForm(string keyValue, TerminalDataSetEntity ds)
 {
     try
     {
         TerminalDataSetBLL bll = new TerminalDataSetBLL();
         bll.SaveForm(keyValue, ds);
         return(Success("操作成功。"));
     }
     catch (Exception ex)
     {
         return(Error(ex.Message));
     }
 }
Ejemplo n.º 5
0
 /// <summary>
 /// 从双控获模块菜单
 /// </summary>
 /// <param name="platform">平台类型 0 windows 1安卓终端 2手机APP</param>
 /// <returns></returns>
 public ActionResult GetMenuList(int platform)
 {
     try
     {
         var columnMenu            = new TerminalDataSetBLL().GetMenuConfigList(platform);
         var firstLevelMenus       = columnMenu.Where(x => x.ParentId == platform.ToString());
         List <MenuTreeModel> data = new List <MenuTreeModel>();
         foreach (var firstmenu in firstLevelMenus)
         {
             data.Add(new MenuTreeModel(firstmenu, platform.ToString()));
         }
         foreach (var firstLevel in data)
         {
             MenuTreeHelper.FomateTree(firstLevel, columnMenu);
         }
         return(Json(data, JsonRequestBehavior.AllowGet));
     }
     catch (Exception ex)
     {
         return(Json(new List <MenuTreeModel>(), JsonRequestBehavior.AllowGet));
     }
 }
Ejemplo n.º 6
0
        public ActionResult GetTerminalPageListJson(Pagination pagination, string queryJson, string DataSetType = null)
        {
            var watch = CommonHelper.TimerStart();
            TerminalDataSetBLL terminalDataSetBLL = new TerminalDataSetBLL();
            //pagination.p_kid = "id";
            //pagination.p_fields = "name,sort,remark,isopen,code,unint,createdate,BK1,BK2,BK3,BK4";
            //pagination.p_tablename = "Base_TerminalDataSet";
            //pagination.conditionJson = " 1=1 ";
            //pagination.sidx = "sort";
            //pagination.sord = "asc";
            Operator user     = OperatorProvider.Provider.Current();
            var      data     = terminalDataSetBLL.GetPageList(pagination, queryJson, DataSetType);
            var      JsonData = new
            {
                rows     = data,
                total    = pagination.total,
                page     = pagination.page,
                records  = pagination.records,
                costtime = CommonHelper.TimerEnd(watch)
            };

            return(Content(JsonData.ToJson()));
        }
Ejemplo n.º 7
0
        /// <summary>
        /// 根据配置获取页面展示
        /// </summary>
        public List <ActivityCategoryEntity> GetActivityMenu(string userId, string deptId, string module)
        {
            //获取双控数据
            var columnMenu = new TerminalDataSetBLL().GetMenuConfigList(0);
            List <ActivityCategoryEntity> result = new List <ActivityCategoryEntity>();

            if (columnMenu.Count > 0)
            {
                //var code = module == "班组活动" ? "activity" : "education";
                var frist = columnMenu.FirstOrDefault(x => x.ModuleCode == module);
                if (frist != null)
                {
                    //配置的二级菜单
                    var second = columnMenu.Where(x => x.ParentId == frist.ModuleId).OrderBy(x => x.Sort);
                    //创建基础类型的查询实体
                    Dictionary <string, string[]> categoryList = new Dictionary <string, string[]>();

                    #region windows code对照表

                    // 教育培训类型  1.技术讲课   2.技术问答  3.事故预想 4.反事故预想 5.新技术问答  6.新事故预想  7.拷问讲解 8考问讲解(集中式)
                    //教育培训	education
                    //安全技术培训	education_edutrain
                    //技术讲课	education_teach
                    //事故预想	education_expect
                    //反事故演习	education_drill
                    //技术问答	education_qaa
                    //考问讲解  education_qa
                    //安全学习日  education_safeday

                    //班组活动	activity
                    //安全日活动	activity_safeday
                    //政治学习	activity_study
                    //民主管理会	activity_manage
                    //班务会	activity_meet
                    //上级精神宣贯	activity_superior



                    #endregion
                    #region 对照类型
                    foreach (var item in second)
                    {
                        if (item.ModuleCode == "education_edutrain")
                        {
                            continue;
                        }
                        switch (item.ModuleCode)
                        {
                        //教育培训的分类
                        //技术讲课 1
                        case "education_teach":
                            categoryList.Add(item.ModuleCode, new string[] { "1", item.ModuleName });
                            break;

                        //技术问答 2
                        case "education_qaa":
                            categoryList.Add(item.ModuleCode, new string[] { "2", item.ModuleName });
                            break;

                        //事故预想 3
                        case "education_expect":
                            categoryList.Add(item.ModuleCode, new string[] { "3", item.ModuleName });
                            break;

                        //反事故演习 4
                        case "education_drill":
                            categoryList.Add(item.ModuleCode, new string[] { "4", item.ModuleName });
                            break;

                        //拷问讲解 7
                        case "education_qa":
                            categoryList.Add(item.ModuleCode, new string[] { "7", item.ModuleName });
                            break;

                        //安全学习日
                        case "education_safeday":
                            categoryList.Add("EA", new string[] { item.ModuleName });
                            break;

                        //其他活动
                        default:
                            categoryList.Add(item.ModuleCode, new string[] { item.ModuleName });
                            break;
                        }
                    }
                    #endregion

                    result = service.GetMenuIndex(module, userId, deptId, categoryList);
                }
            }

            return(result);
        }
Ejemplo n.º 8
0
        /// <summary>
        /// 根据配置获取页面展示
        /// </summary>
        public JsonResult GetActualWarning()
        {
            var user          = OperatorProvider.Provider.Current();
            var traingtype    = Config.GetValue("TrainingType");
            var CustomerModel = Config.GetValue("CustomerModel");
            var data          = new List <IndexActualModel>();

            data = CacheFactory.Cache().GetCache <List <IndexActualModel> >("ActualWarning_" + user.DeptId);
            if (data != null)
            {
                return(Json(data));
            }
            else
            {
                data = new List <IndexActualModel>();
            }
            //获取双控菜单配置
            var MenuData     = new TerminalDataSetBLL().GetMenuConfigList(1);
            var RealTimeBool = new bool[] { false, false, false, true, false };
            var one          = MenuData.Where(x => x.ModuleName == "班前班后会").FirstOrDefault();//班前班后会

            if (one != null)
            {
                RealTimeBool[0] = true;
            }
            var two = MenuData.Where(x => x.ModuleName == "班组活动").FirstOrDefault();//班组活动

            if (two != null)
            {
                RealTimeBool[1] = true;
            }
            var three      = MenuData.Where(x => x.ModuleName == traingtype || x.ModuleName == CustomerModel).FirstOrDefault();//人身风险预控 or CustomerModel
            var ModuleName = string.Empty;

            if (three != null)
            {
                RealTimeBool[2] = true;
                ModuleName      = three.ModuleName;
            }
            var five = MenuData.Where(x => x.ModuleName == "教育培训").FirstOrDefault();//教育培训

            if (five != null)
            {
                RealTimeBool[4] = true;
            }

            var DictionaryData = new IndexManageBLL().RealTime(user.DeptId, ModuleName, RealTimeBool, user.UserId);



            //排序
            foreach (var item in DictionaryData)
            {
                var One = new IndexActualModel()
                {
                    name = item.Key,
                    num  = item.Value,
                    sort = item.Key.Contains("连续一周") ? 1 : item.Key.Contains("连续两周") ? 2 : item.Key.Contains("今日未开展人身风险预控") ? 3 : item.Key.Contains("14天未开展") ? 4 : item.Key.Contains("未整改违章") ? 5 : item.Key.Contains("未整改隐患") ? 6 : 7,
                };
                data.Add(One);
            }
            data = data.OrderBy(x => x.sort).ToList();
            CacheFactory.Cache().WriteCache(data, "ActualWarning_" + user.DeptId, DateTime.Now.AddHours(5));
            return(Json(data));
        }
Ejemplo n.º 9
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="searchDeptId">所查询的指标的部门ID 一般为电厂的Id</param>
        /// <param name="userId">当前用户的Id 取数据用</param>
        /// <param name="indexType">指标类型 0管理平台  1安卓终端  2手机APP </param>
        /// <param name="userDeptId">当前用户的所属的部门Id   取数据用</param>
        /// <param name="terminalType">查询类型         0月 1季  2年</param>
        /// <param name="templet">模板 所属的模板  1第一套  2 第二套 以此类推</param>
        /// <returns></returns>
        public List <IndexManageModel> GetIndexData(string searchDeptId, string userId, int indexType, string userDeptId, string terminalType, int?templet)
        {
            TerminalDataSetBLL terminalDataSetBLL = new TerminalDataSetBLL();
            IndexManageBLL     indexManageBLL     = new IndexManageBLL();

            List <TerminalDataSetEntity> entitys = terminalDataSetBLL.GetList().Where(p => p.IsOpen == 1).ToList(); //先取所有的指标
                                                                                                                    //再取所有的分类
            List <IndexManageEntity> manageEntities = indexManageBLL.GetList(searchDeptId, indexType, null, templet).Where(p => p.IsShow == 1).ToList();
            //获取分类底下的指标
            List <IndexAssocationEntity> indexAssocationEntities = new IIndexAssocationBLL().GetListByTitleId(manageEntities.Select(p => p.Id).ToArray());
            //查询并组装指标值的数据
            var dataSetIds = indexAssocationEntities.Select(x => x.DataSetId);//所有的指标的Ids
            Dictionary <string, string> dic = new Dictionary <string, string>();

            entitys.Where(x => dataSetIds.Contains(x.Id)).ToList().ForEach(x => {
                dic.Add(x.Code + "-" + x.Name, terminalType);
            });//应该要绑定的所有的指标

            List <KeyValue> keyValues = FindAllCount(userId, userDeptId, dic);
            //List<KeyValue> keyValues = FindAllCount(userId, userDeptId, terminalType);
            List <IndexManageModel> models = new List <IndexManageModel>();

            if (manageEntities != null && manageEntities.Count > 0)
            {
                manageEntities.ForEach(title =>
                {
                    //生成分类
                    IndexManageModel model = new IndexManageModel()
                    {
                        TitleId   = title.Id,
                        TitleName = title.Title,
                        Srot      = title.Sort
                    };
                    //生成指标
                    var datasetIds = indexAssocationEntities.Where(p => p.TitleId == title.Id).Select(p => p.DataSetId);
                    List <TerminalDataSetEntity> terminals = entitys.Where(x => datasetIds.Contains(x.Id)).ToList();
                    List <IndexModel> indexModels          = new List <IndexModel>();
                    terminals.ForEach(terminal =>
                    {
                        //组装数据

                        IndexModel indexModel = new IndexModel()
                        {
                            Key     = terminal.Code,
                            Name    = terminal.Name,
                            Sort    = terminal.Sort,
                            IsBZ    = terminal.IsBZ,
                            Unit    = terminal.Unint,
                            Icon    = string.IsNullOrWhiteSpace(terminal.IconUrl) ? null : Config.GetValue("AppUrl") + terminal.IconUrl,
                            Address = terminal.Address
                                      //Value = thisKv == null ? "0" : thisKv.value
                        };
                        if (terminal.IsBZ == "1" && keyValues != null && keyValues.Count > 0)
                        {
                            var thisKv       = keyValues.FirstOrDefault(p => p.key == terminal.Code);
                            indexModel.Value = thisKv == null ? "0" : thisKv.value;
                        }
                        indexModels.Add(indexModel);
                    });
                    model.AddChilds(indexModels);
                    models.Add(model);
                });
            }
            return(models);
        }