Esempio n. 1
0
        public JsonResult SaveValControl(ValControlInfo info)
        {
            if (CheckSession() == false)
            {
                return(Json(ResultModelBase.CreateTimeoutModel(), JsonRequestBehavior.AllowGet));
            }
            if (CheckSessionID() == false)
            {
                return(Json(ResultModelBase.CreateLogoutModel(), JsonRequestBehavior.AllowGet));
            }

            ResultModelBase result = new ResultModelBase();

            try
            {
                info.User.ID = GetLoginUser().ID;
                this.valuationManager.SaveValControl(info);
            }
            catch (Exception ex)
            {
                NLog.LogManager.GetCurrentClassLogger().Error(ex, ex.Message);
                result.SetFailed(ResultCodes.SystemError, ControlManager.GetSettingInfo().ErrorMessage);
            }
            return(JsonResult(result));
        }
Esempio n. 2
0
        /// <summary>
        /// 删除附件
        /// </summary>
        /// <param name="objectTypeId">附件对象类型ID</param>
        /// <param name="id">附件编号</param>
        /// <returns>删除附件返回信息</returns>
        public JsonResult DeleteUploadFile(int objectTypeId, int id)
        {
            if (CheckSession(false) == false)
            {
                return(Json(ResultModelBase.CreateTimeoutModel(), JsonRequestBehavior.AllowGet));
            }
            if (CheckSessionID() == false)
            {
                return(Json(ResultModelBase.CreateLogoutModel(), JsonRequestBehavior.AllowGet));
            }

            ResultModelBase result = new ResultModelBase();

            try
            {
                if (id < 0)
                {
                    DeleteUploadFileInSession(id);
                }
                else
                {
                    this.fileManager.DeleteUploadFileByID(objectTypeId, id);
                }
            }
            catch (Exception ex)
            {
                NLog.LogManager.GetCurrentClassLogger().Error(ex, ex.Message);
                result.SetFailed(ResultCodes.SystemError, ControlManager.GetSettingInfo().ErrorMessage);
            }
            return(JsonResult(result));
        }
Esempio n. 3
0
        public JsonResult SaveEquipmentInfo(EquipmentInfo equipmentInfo)
        {
            if (CheckSession(false) == false)
            {
                return(Json(ResultModelBase.CreateTimeoutModel(), JsonRequestBehavior.AllowGet));
            }
            if (CheckSessionID() == false)
            {
                return(Json(ResultModelBase.CreateLogoutModel(), JsonRequestBehavior.AllowGet));
            }

            ResultModel <EquipmentInfo> result = new ResultModel <EquipmentInfo>();

            try
            {
                List <UploadFileInfo> files = GetUploadFilesInSession();

                equipmentInfo = this.equipmentManager.SaveEquipment(equipmentInfo, files, GetLoginUser());

                result.Data = equipmentInfo;
            }
            catch (Exception ex)
            {
                NLog.LogManager.GetCurrentClassLogger().Error(ex, ex.Message);
                result.SetFailed(ResultCodes.SystemError, ControlManager.GetSettingInfo().ErrorMessage);
            }
            return(JsonResult(result));
        }
Esempio n. 4
0
        /// <summary>
        /// 通过请求编号获取最新派工单信息
        /// </summary>
        /// <param name="id">请求编号</param>
        /// <returns>最新派工单信息</returns>
        public JsonResult GetDispatchByRequestID(int id)
        {
            ResultModel <DispatchInfo> result = new ResultModel <DispatchInfo>();

            if (CheckSession(false) == false)
            {
                return(Json(ResultModelBase.CreateTimeoutModel(), JsonRequestBehavior.AllowGet));
            }
            if (CheckSessionID() == false)
            {
                return(Json(ResultModelBase.CreateLogoutModel(), JsonRequestBehavior.AllowGet));
            }
            try
            {
                DispatchInfo dispatchInfo = this.dispatchDao.GetDispatchByRequestID(id);
                if (dispatchInfo != null)
                {
                    UserInfo userInfo = userManager.GetUser(dispatchInfo.Engineer.ID);
                    if (userInfo != null)
                    {
                        dispatchInfo.Engineer.Name = userInfo.Name;
                    }
                    result.Data = dispatchInfo;
                }
            }
            catch (Exception ex)
            {
                NLog.LogManager.GetCurrentClassLogger().Error(ex, ex.Message);
                result.SetFailed(ResultCodes.SystemError, ControlManager.GetSettingInfo().ErrorMessage);
            }
            return(JsonResult(result));
        }
Esempio n. 5
0
        public JsonResult AddRequest(RequestInfo info)
        {
            if (CheckSession(false) == false)
            {
                return(Json(ResultModelBase.CreateTimeoutModel(), JsonRequestBehavior.AllowGet));
            }
            if (CheckSessionID() == false)
            {
                return(Json(ResultModelBase.CreateLogoutModel(), JsonRequestBehavior.AllowGet));
            }

            ResultModelBase result = new ResultModelBase();

            try
            {
                List <UploadFileInfo> files = GetUploadFilesInSession();

                info.RequestUser = GetLoginUser();
                info.Status.ID   = RequestInfo.Statuses.New;
                info.Source.ID   = RequestInfo.Sources.ManualRequest;
                info.Source.Name = RequestInfo.Sources.GetSourceDesc(info.Source.ID);

                info.ID = this.requestManager.AddRequest(info, files, GetLoginUser());
            }
            catch (Exception ex)
            {
                NLog.LogManager.GetCurrentClassLogger().Error(ex, ex.Message);
                result.SetFailed(ResultCodes.SystemError, ControlManager.GetSettingInfo().ErrorMessage);
            }
            return(JsonResult(result));
        }
Esempio n. 6
0
        public JsonResult GetWebData(int fujiClass2ID, int months, int componentID = 0)
        {
            if (CheckSession(false) == false)
            {
                return(Json(ResultModelBase.CreateTimeoutModel(), JsonRequestBehavior.AllowGet));
            }
            ResultModel <Dictionary <string, object> > result = new ResultModel <Dictionary <string, object> >();

            try
            {
                Dictionary <string, object> data = new Dictionary <string, object>();
                if (componentID == 0)
                {
                    data = this.fujiClassManager.GetRepairWebData(fujiClass2ID, months);
                }
                else
                {
                    data = this.fujiClassManager.GetComponentWebData(fujiClass2ID, componentID, months);
                }

                result.Data = data;
            }
            catch (Exception ex)
            {
                NLog.LogManager.GetCurrentClassLogger().Error(ex, ex.Message);
                result.SetFailed(ResultCodes.SystemError, ControlManager.GetSettingInfo().ErrorMessage);
            }
            return(JsonResult(result));
        }
Esempio n. 7
0
        public JsonResult UpdatePassword(string loginPwd)
        {
            if (CheckSession() == false)
            {
                return(Json(ResultModelBase.CreateTimeoutModel(), JsonRequestBehavior.AllowGet));
            }
            if (CheckSessionID() == false)
            {
                return(Json(ResultModelBase.CreateLogoutModel(), JsonRequestBehavior.AllowGet));
            }

            ResultModelBase result = new ResultModelBase();

            try
            {
                int    ID  = GetLoginUser().ID;
                string pwd = this.userManager.GetUser(ID).LoginPwd;
                if (loginPwd == pwd)
                {
                    result.SetFailed(ResultCodes.ParameterError, "与原密码相同,请重新输入");
                    return(JsonResult(result));
                }
                this.userManager.UpdatePassword(ID, loginPwd);
            }
            catch (Exception ex)
            {
                NLog.LogManager.GetCurrentClassLogger().Error(ex, ex.Message);
                result.SetFailed(ResultCodes.SystemError, ControlManager.GetSettingInfo().ErrorMessage);
            }
            return(JsonResult(result));
        }
Esempio n. 8
0
        /// <summary>
        /// 获取科室信息
        /// </summary>
        /// <param name="inputText">搜索内容</param>
        /// <returns>科室信息</returns>
        public JsonResult QueryDepartment4AutoCompleteVal(string inputText)
        {
            if (CheckSession(false) == false)
            {
                return(Json(ResultModelBase.CreateTimeoutModel(), JsonRequestBehavior.AllowGet));
            }

            ResultModel <List <DepartmentInfo> > result = new ResultModel <List <DepartmentInfo> >();

            try
            {
                List <DepartmentInfo> infos = new List <DepartmentInfo>();

                infos = this.departmentDao.QueryDepartment4AutoCompleteVal(inputText, 0, ConstDefinition.PAGE_SIZE);


                result.Data = infos;
            }
            catch (Exception ex)
            {
                NLog.LogManager.GetCurrentClassLogger().Error(ex, ex.Message);
                result.SetFailed(ResultCodes.SystemError, ControlManager.GetSettingInfo().ErrorMessage);
            }
            return(JsonResult(result));
        }
        /// <summary>
        /// 获取服务凭证列表信息
        /// </summary>
        /// <param name="status">服务凭证状态</param>
        /// <param name="urgency">派工单紧急程度</param>
        /// <param name="filterField">搜索字段</param>
        /// <param name="filterText">搜索框填写内容</param>
        /// <param name="sortField">排序字段</param>
        /// <param name="sortDirection">排序方式</param>
        /// <param name="currentPage">页码</param>
        /// <param name="pageSize">每页信息条数</param>
        /// <returns>服务凭证列表信息</returns>
        public JsonResult QueryDispatchJournals(int status, int urgency, string filterField, string filterText, string sortField, bool sortDirection, int currentPage, int pageSize = ConstDefinition.PAGE_SIZE)
        {
            ResultModel <List <DispatchJournalInfo> > result = new ResultModel <List <DispatchJournalInfo> >();

            if (CheckSession() == false)
            {
                return(Json(ResultModelBase.CreateTimeoutModel(), JsonRequestBehavior.AllowGet));
            }
            if (CheckSessionID() == false)
            {
                return(Json(ResultModelBase.CreateLogoutModel(), JsonRequestBehavior.AllowGet));
            }
            try
            {
                BaseDao.ProcessFieldFilterValue(filterField, ref filterText);
                if (currentPage > 0)
                {
                    int totalNum = this.dispatchDao.QueryDispatchJournalsCount(status, urgency, filterField, filterText);

                    result.SetTotalPages(totalNum, pageSize);
                    result.Data = dispatchManager.QueryDispatchJournals(status, urgency, filterField, filterText, sortField, sortDirection, result.GetCurRowNum(currentPage, pageSize), pageSize);
                }
                else
                {
                    result.Data = dispatchManager.QueryDispatchJournals(status, urgency, filterField, filterText, sortField, sortDirection, 0, pageSize);
                }
            }
            catch (Exception ex)
            {
                NLog.LogManager.GetCurrentClassLogger().Error(ex, ex.Message);
                result.SetFailed(ResultCodes.SystemError, ControlManager.GetSettingInfo().ErrorMessage);
            }
            return(JsonResult(result));
        }
Esempio n. 10
0
        public JsonResult SaveDispatchReport(DispatchReportInfo dispatchReport)
        {
            ResultModelBase result = new ResultModelBase();

            if (CheckSession() == false)
            {
                return(Json(ResultModelBase.CreateTimeoutModel(), JsonRequestBehavior.AllowGet));
            }
            if (CheckSessionID() == false)
            {
                return(Json(ResultModelBase.CreateLogoutModel(), JsonRequestBehavior.AllowGet));
            }
            try
            {
                DispatchInfo dispatch = this.dispatchManager.GetDispatchByID(dispatchReport.Dispatch.ID);
                if (dispatch.DispatchReport.Status.ID != DispatchInfo.DocStatus.New)
                {
                    result.SetFailed(ResultCodes.ParameterError, "不可重复提交");
                }
                else
                {
                    this.dispatchManager.SaveDispatchReport(dispatchReport, GetLoginUser());
                }
            }
            catch (Exception ex)
            {
                NLog.LogManager.GetCurrentClassLogger().Error(ex, ex.Message);
                result.SetFailed(ResultCodes.SystemError, ControlManager.GetSettingInfo().ErrorMessage);
            }
            return(JsonResult(result));
        }
Esempio n. 11
0
        public JsonResult SaveReportComponent(ReportComponentInfo info)
        {
            ResultModel <ReportComponentInfo> result = new ResultModel <ReportComponentInfo>();

            if (CheckSession(false) == false)
            {
                return(Json(ResultModelBase.CreateTimeoutModel(), JsonRequestBehavior.AllowGet));
            }
            if (CheckSessionID() == false)
            {
                return(Json(ResultModelBase.CreateLogoutModel(), JsonRequestBehavior.AllowGet));
            }
            try
            {
                List <UploadFileInfo> fileReportComponent = GetUploadFilesInSession();

                if (fileReportComponent != null)
                {
                    foreach (UploadFileInfo file in fileReportComponent)
                    {
                        file.FileContent = ParseBase64String(file.FileContent);
                    }
                }

                info        = dispatchManager.SaveReportComponent(info, fileReportComponent);
                result.Data = info;
            }
            catch (Exception ex)
            {
                NLog.LogManager.GetCurrentClassLogger().Error(ex, ex.Message);
                result.SetFailed(ResultCodes.SystemError, ControlManager.GetSettingInfo().ErrorMessage);
            }
            return(JsonResult(result));
        }
Esempio n. 12
0
        public JsonResult SaveContract(ContractInfo contract)
        {
            ResultModel <int> result = new ResultModel <int>();

            if (CheckSession(false) == false)
            {
                return(Json(ResultModelBase.CreateTimeoutModel(), JsonRequestBehavior.AllowGet));
            }
            if (CheckSessionID() == false)
            {
                return(Json(ResultModelBase.CreateLogoutModel(), JsonRequestBehavior.AllowGet));
            }
            try
            {
                List <UploadFileInfo> fileContractInfos = GetUploadFilesInSession();

                contract.ID = this.contractManager.SaveContract(contract, fileContractInfos, GetLoginUser());
                result.Data = contract.ID;
            }
            catch (Exception ex)
            {
                NLog.LogManager.GetCurrentClassLogger().Error(ex, ex.Message);
                result.SetFailed(ResultCodes.SystemError, ControlManager.GetSettingInfo().ErrorMessage);
            }
            return(JsonResult(result));
        }
Esempio n. 13
0
        public ActionResult RunVal()
        {
            if (CheckSession() == false)
            {
                return(Json(ResultModelBase.CreateTimeoutModel(), JsonRequestBehavior.AllowGet));
            }
            if (CheckSessionID() == false)
            {
                return(Json(ResultModelBase.CreateLogoutModel(), JsonRequestBehavior.AllowGet));
            }

            ResultModel <Dictionary <string, object> > result = new ResultModel <Dictionary <string, object> >();

            try
            {
                this.valuationManager.RunVal(GetLoginUser().ID);
                result.Data = this.valuationManager.GetValResultData(GetLoginUser().ID);
            }
            catch (Exception ex)
            {
                NLog.LogManager.GetCurrentClassLogger().Error(ex, ex.Message);
                result.SetFailed(ResultCodes.SystemError, ControlManager.GetSettingInfo().ErrorMessage);
            }
            return(JsonResult(result));
        }
Esempio n. 14
0
        /// <summary>
        /// 初始化备用机
        /// </summary>
        /// <returns>初始化结果</returns>
        public JsonResult InitValSpares()
        {
            if (CheckSession() == false)
            {
                return(Json(ResultModelBase.CreateTimeoutModel(), JsonRequestBehavior.AllowGet));
            }
            if (CheckSessionID() == false)
            {
                return(Json(ResultModelBase.CreateLogoutModel(), JsonRequestBehavior.AllowGet));
            }

            ResultModelBase result = new ResultModelBase();

            try
            {
                this.valuationDao.DeleteSpares(GetLoginUser().ID);
                this.valuationDao.InitSpares(GetLoginUser().ID);
            }
            catch (Exception ex)
            {
                NLog.LogManager.GetCurrentClassLogger().Error(ex, ex.Message);
                result.SetFailed(ResultCodes.SystemError, ControlManager.GetSettingInfo().ErrorMessage);
            }
            return(JsonResult(result));
        }
Esempio n. 15
0
        /// <summary>
        /// 保存富士II类信息
        /// </summary>
        /// <param name="info">关联信息</param>
        /// <param name="isUpdate">是否更新</param>
        /// <param name="copyID">复制的II类id</param>
        /// <returns>富士II类id</returns>
        public JsonResult SaveFujiClass2(FujiClassLink info, bool isUpdate, int copyID = 0)
        {
            if (CheckSession() == false)
            {
                return(Json(ResultModelBase.CreateTimeoutModel(), JsonRequestBehavior.AllowGet));
            }
            if (CheckSessionID() == false)
            {
                return(Json(ResultModelBase.CreateLogoutModel(), JsonRequestBehavior.AllowGet));
            }

            ResultModelBase result = new ResultModelBase();

            try
            {
                this.fujiClassManager.SaveFujiClass2(info, GetLoginUser(), isUpdate, copyID);
            }
            catch (Exception ex)
            {
                NLog.LogManager.GetCurrentClassLogger().Error(ex, ex.Message);
                result.SetFailed(ResultCodes.SystemError, ControlManager.GetSettingInfo().ErrorMessage);
            }

            return(Json(result, JsonRequestBehavior.AllowGet));
        }
Esempio n. 16
0
        public JsonResult SaveDispatchJournal(DispatchJournalInfo dispatchJournal)
        {
            ResultModel <int> result = new ResultModel <int>();

            if (CheckSession(false) == false)
            {
                return(Json(ResultModelBase.CreateTimeoutModel(), JsonRequestBehavior.AllowGet));
            }
            if (CheckSessionID() == false)
            {
                return(Json(ResultModelBase.CreateLogoutModel(), JsonRequestBehavior.AllowGet));
            }
            try
            {
                dispatchJournal.FileContent = ParseBase64String(dispatchJournal.FileContent);

                dispatchJournal = this.dispatchManager.SaveDispatchJournal(dispatchJournal, GetLoginUser());
                result.Data     = dispatchJournal.ID;
            }
            catch (Exception ex)
            {
                NLog.LogManager.GetCurrentClassLogger().Error(ex, ex.Message);
                result.SetFailed(ResultCodes.SystemError, ControlManager.GetSettingInfo().ErrorMessage);
            }
            return(JsonResult(result));
        }
Esempio n. 17
0
        /// <summary>
        /// 批量保存富士II类信息
        /// </summary>
        /// <param name="infos">富士II类信息</param>
        /// <param name="type">费用类型</param>
        /// <returns>保存结果</returns>
        public JsonResult SaveFujiClass2s(List <FujiClass2Info> infos, FujiClass2Info.SectionType type)
        {
            if (CheckSession() == false)
            {
                return(Json(ResultModelBase.CreateTimeoutModel(), JsonRequestBehavior.AllowGet));
            }
            if (CheckSessionID() == false)
            {
                return(Json(ResultModelBase.CreateLogoutModel(), JsonRequestBehavior.AllowGet));
            }

            ResultModelBase result = new ResultModelBase();

            try
            {
                this.fujiClassManager.SaveFujiClass2s(infos, type, GetLoginUser());
            }
            catch (Exception ex)
            {
                NLog.LogManager.GetCurrentClassLogger().Error(ex, ex.Message);
                result.SetFailed(ResultCodes.SystemError, ControlManager.GetSettingInfo().ErrorMessage);
            }

            return(Json(result, JsonRequestBehavior.AllowGet));
        }
Esempio n. 18
0
        public JsonResult TestSms(string mobilePhone)
        {
            if (CheckSession() == false)
            {
                return(Json(ResultModelBase.CreateTimeoutModel(), JsonRequestBehavior.AllowGet));
            }
            if (CheckSessionID() == false)
            {
                return(Json(ResultModelBase.CreateLogoutModel(), JsonRequestBehavior.AllowGet));
            }

            ResultModel <String> result = new ResultModel <String>();

            try
            {
                bool send = this.userManager.SendPhoneVerify(mobilePhone, WebConfig.SMS_SDK_APP_ID, WebConfig.SMS_SDK_APP_KEY, WebConfig.SMS_PERIOD, WebConfig.SMS_SIGNATURE, WebConfig.SMS_TEMPLATEID);
                if (send)
                {
                    result.Data = "1";
                }
                else
                {
                    result.Data = "0";
                }
            }
            catch (Exception ex)
            {
                NLog.LogManager.GetCurrentClassLogger().Error(ex, ex.Message);
                result.SetFailed(ResultCodes.SystemError, ControlManager.GetSettingInfo().ErrorMessage);
            }

            return(JsonResult(result));
        }
Esempio n. 19
0
        /// <summary>
        /// 获取富士II类信息
        /// </summary>
        /// <param name="class1">富士I类id</param>
        /// <param name="class2">富士II类id</param>
        /// <param name="filterField">搜索字段</param>
        /// <param name="filterText">搜索内容</param>
        /// <param name="sortField">排序字段</param>
        /// <param name="sortDirection">排序方式</param>
        /// <param name="currentPage">页码</param>
        /// <param name="pageSize">每页展示数据条数</param>
        /// <returns>富士II类信息</returns>
        public JsonResult QueryFujiClass2s(int class1, int class2, string filterField, string filterText, string sortField, bool sortDirection, int currentPage, int pageSize = ConstDefinition.PAGE_SIZE)
        {
            if (CheckSession() == false)
            {
                return(Json(ResultModelBase.CreateTimeoutModel(), JsonRequestBehavior.AllowGet));
            }
            if (CheckSessionID() == false)
            {
                return(Json(ResultModelBase.CreateLogoutModel(), JsonRequestBehavior.AllowGet));
            }

            ResultModel <List <FujiClass2Info> > result = new ResultModel <List <FujiClass2Info> >();

            try
            {
                if (currentPage > 0)
                {
                    int totalNum = this.fujiClassDao.QueryFujiClass2Count(class1, class2, filterField, filterText);
                    result.SetTotalPages(totalNum, pageSize);
                    result.Data = this.fujiClassDao.QueryFujiClass2s(class1, class2, filterField, filterText, sortField, sortDirection, result.GetCurRowNum(currentPage, pageSize), pageSize);
                }
                else
                {
                    result.Data = this.fujiClassManager.QueryFujiClass2s(class1, class2, filterField, filterText, sortField, sortDirection);
                }
            }
            catch (Exception ex)
            {
                NLog.LogManager.GetCurrentClassLogger().Error(ex, ex.Message);
                result.SetFailed(ResultCodes.SystemError, ControlManager.GetSettingInfo().ErrorMessage);
            }
            return(JsonResult(result));
        }
Esempio n. 20
0
        public JsonResult SetLoop(int id)
        {
            if (CheckSession() == false)
            {
                return(Json(ResultModelBase.CreateTimeoutModel(), JsonRequestBehavior.AllowGet));
            }
            if (CheckSessionID() == false)
            {
                return(Json(ResultModelBase.CreateLogoutModel(), JsonRequestBehavior.AllowGet));
            }

            ResultModel <NoticeInfo> result = new ResultModel <NoticeInfo>();

            try
            {
                NoticeInfo editNoticeInfo = this.noticeManager.SetLoop(id);
                result.Data = editNoticeInfo;
            }
            catch (Exception ex)
            {
                NLog.LogManager.GetCurrentClassLogger().Error(ex, ex.Message);
                result.SetFailed(ResultCodes.SystemError, ControlManager.GetSettingInfo().ErrorMessage);
            }
            return(JsonResult(result));
        }
Esempio n. 21
0
        /// <summary>
        /// 通过请求编号获取请求信息
        /// </summary>
        /// <param name="id">请求编号</param>
        /// <returns>请求信息</returns>
        public JsonResult QueryRequestByID(int id)
        {
            ResultModel <RequestInfo> result = new ResultModel <RequestInfo>();

            if (CheckSession(false) == false)
            {
                return(Json(ResultModelBase.CreateTimeoutModel(), JsonRequestBehavior.AllowGet));
            }
            if (CheckSessionID() == false)
            {
                return(Json(ResultModelBase.CreateLogoutModel(), JsonRequestBehavior.AllowGet));
            }
            try
            {
                RequestInfo requestInfo = this.requestManager.GetRequest(id);

                result.Data = requestInfo;
            }
            catch (Exception ex)
            {
                NLog.LogManager.GetCurrentClassLogger().Error(ex, ex.Message);
                result.SetFailed(ResultCodes.SystemError, ControlManager.GetSettingInfo().ErrorMessage);
            }
            return(JsonResult(result));
        }
Esempio n. 22
0
        /// <summary>
        /// 获取富士II类信息
        /// </summary>
        /// <param name="inputText">搜索内容</param>
        /// <param name="fujiClass1ID">富士I类id</param>
        /// <returns>富士II类信息</returns>
        public JsonResult QueryFujiClass24AutoComplete(string inputText, int fujiClass1ID)
        {
            if (CheckSession() == false)
            {
                return(Json(ResultModelBase.CreateTimeoutModel(), JsonRequestBehavior.AllowGet));
            }
            if (CheckSessionID() == false)
            {
                return(Json(ResultModelBase.CreateLogoutModel(), JsonRequestBehavior.AllowGet));
            }

            ResultModel <List <FujiClass2Info> > result = new ResultModel <List <FujiClass2Info> >();

            try
            {
                List <FujiClass2Info> infos = new List <FujiClass2Info>();

                infos = this.fujiClassDao.QueryFujiClass24AutoComplete(inputText, fujiClass1ID);

                result.Data = infos;
            }
            catch (Exception ex)
            {
                NLog.LogManager.GetCurrentClassLogger().Error(ex, ex.Message);
                result.SetFailed(ResultCodes.SystemError, ControlManager.GetSettingInfo().ErrorMessage);
            }
            return(JsonResult(result));
        }
Esempio n. 23
0
        /// <summary>
        /// 判断请求是否有作业中的派工单
        /// </summary>
        /// <param name="id">请求编号</param>
        /// <returns>true/false 是否有作业中的派工单</returns>
        public JsonResult CheckOpenDispatchesExist(int id)
        {
            ResultModel <bool> result = new ResultModel <bool>();

            if (CheckSession(false) == false)
            {
                return(Json(ResultModelBase.CreateTimeoutModel(), JsonRequestBehavior.AllowGet));
            }
            if (CheckSessionID() == false)
            {
                return(Json(ResultModelBase.CreateLogoutModel(), JsonRequestBehavior.AllowGet));
            }
            try
            {
                List <DispatchInfo> dispatchInfos = this.dispatchDao.GetOpenDispatchesByRequestID(id);
                if (dispatchInfos.Count > 0)
                {
                    result.Data = true;
                }
                else
                {
                    result.Data = false;
                }
            }
            catch (Exception ex)
            {
                NLog.LogManager.GetCurrentClassLogger().Error(ex, ex.Message);
                result.SetFailed(ResultCodes.SystemError, ControlManager.GetSettingInfo().ErrorMessage);
            }
            return(JsonResult(result));
        }
Esempio n. 24
0
        /// <summary>
        /// 获取富士II类信息
        /// </summary>
        /// <returns>富士II类信息</returns>
        public JsonResult GetFujiClass2()
        {
            if (CheckSession() == false)
            {
                return(Json(ResultModelBase.CreateTimeoutModel(), JsonRequestBehavior.AllowGet));
            }
            if (CheckSessionID() == false)
            {
                return(Json(ResultModelBase.CreateLogoutModel(), JsonRequestBehavior.AllowGet));
            }

            ResultModel <List <FujiClass2Info> > result = new ResultModel <List <FujiClass2Info> >();

            try
            {
                List <FujiClass2Info> data = this.fujiClassDao.GetFujiClass2();
                int index = data.FindIndex(info => info.ID == -1);
                if (index != -1)
                {
                    data.SwapOrder(index, data.Count - 1);
                }
                result.Data = data;
            }
            catch (Exception ex)
            {
                NLog.LogManager.GetCurrentClassLogger().Error(ex, ex.Message);
                result.SetFailed(ResultCodes.SystemError, ControlManager.GetSettingInfo().ErrorMessage);
            }
            return(JsonResult(result));
        }
Esempio n. 25
0
        public JsonResult DispatchRequest(RequestInfo requestInfo, DispatchInfo dispatchInfo)
        {
            if (CheckSession(false) == false)
            {
                return(Json(ResultModelBase.CreateTimeoutModel(), JsonRequestBehavior.AllowGet));
            }
            if (CheckSessionID() == false)
            {
                return(Json(ResultModelBase.CreateLogoutModel(), JsonRequestBehavior.AllowGet));
            }

            ResultModelBase result = new ResultModelBase();

            try
            {
                List <DispatchInfo> dispatchInfos = this.dispatchDao.GetOpenDispatchesByRequestID(requestInfo.ID);
                foreach (DispatchInfo dispatch in dispatchInfos)
                {
                    if (dispatch.Engineer.ID == dispatchInfo.Engineer.ID)
                    {
                        result.SetFailed(ResultCodes.ParameterError, "该工程师已被派工且未完成");
                        return(JsonResult(result));
                    }
                }
                this.requestManager.DispatchRequest(requestInfo, dispatchInfo, GetLoginUser());
            }
            catch (Exception ex)
            {
                NLog.LogManager.GetCurrentClassLogger().Error(ex, ex.Message);
                result.SetFailed(ResultCodes.SystemError, ControlManager.GetSettingInfo().ErrorMessage);
            }
            return(JsonResult(result));
        }
Esempio n. 26
0
        /// <summary>
        /// 获取故障率信息
        /// </summary>
        /// <param name="objID">故障对象id</param>
        /// <param name="type">故障对象类型</param>
        /// <returns>故障率信息</returns>
        public JsonResult GetFaultRatesByObjID(int objID, FaultRateInfo.ObjectType type)
        {
            if (!CheckSession())
            {
                return(Json(ResultModelBase.CreateTimeoutModel(), JsonRequestBehavior.AllowGet));
            }
            if (CheckSessionID() == false)
            {
                return(Json(ResultModelBase.CreateLogoutModel(), JsonRequestBehavior.AllowGet));
            }

            ResultModel <List <FaultRateInfo> > result = new ResultModel <List <FaultRateInfo> >();

            try
            {
                List <FaultRateInfo> infos = new List <FaultRateInfo>();
                infos = this.faultRateDao.GetFaultRateByObject(objID, type);

                result.Data = infos;
            }
            catch (Exception ex)
            {
                NLog.LogManager.GetCurrentClassLogger().Error(ex, ex.Message);
                result.SetFailed(ResultCodes.SystemError, ControlManager.GetSettingInfo().ErrorMessage);
            }
            return(JsonResult(result));
        }
Esempio n. 27
0
        /// <summary>
        /// 获取设备的生命周期
        /// </summary>
        /// <param name="equipmentID">设备编号</param>
        /// <returns>设备生命周期信息</returns>
        public JsonResult GetTimeLine(int equipmentID)
        {
            if (CheckSession() == false)
            {
                return(Json(ResultModelBase.CreateTimeoutModel(), JsonRequestBehavior.AllowGet));
            }
            if (CheckSessionID() == false)
            {
                return(Json(ResultModelBase.CreateLogoutModel(), JsonRequestBehavior.AllowGet));
            }

            ResultModel <EquipmentInfo> result = new ResultModel <EquipmentInfo>();

            try
            {
                EquipmentInfo info = this.equipmentManager.GetTimeLine(equipmentID);
                result.Data = info;
            }
            catch (Exception ex)
            {
                NLog.LogManager.GetCurrentClassLogger().Error(ex, ex.Message);
                result.SetFailed(ResultCodes.SystemError, ControlManager.GetSettingInfo().ErrorMessage);
            }
            return(JsonResult(result));
        }
Esempio n. 28
0
        /// <summary>
        /// 根据设备类别获取富士II类信息
        /// </summary>
        /// <param name="equipmentClass1">设备1类</param>
        /// <param name="equipmentClass2">设备2类</param>
        /// <returns>富士II类信息</returns>
        public JsonResult GetFujiClass2ByEqptClass(string equipmentClass1, string equipmentClass2)
        {
            if (!CheckSession(false))
            {
                return(Json(ResultModelBase.CreateTimeoutModel(), JsonRequestBehavior.AllowGet));
            }
            if (CheckSessionID() == false)
            {
                return(Json(ResultModelBase.CreateLogoutModel(), JsonRequestBehavior.AllowGet));
            }

            ResultModel <List <FujiClass2Info> > result = new ResultModel <List <FujiClass2Info> >();

            try
            {
                List <FujiClass2Info> infos = this.fujiClassDao.GetFujiClass2ByEqptClass(equipmentClass1, equipmentClass2);

                if (infos.Count == 0)
                {
                    infos.Add(this.fujiClassDao.GetFujiClass2ByID(-1));
                }

                result.Data = infos;
            }
            catch (Exception ex)
            {
                NLog.LogManager.GetCurrentClassLogger().Error(ex, ex.Message);
                result.SetFailed(ResultCodes.SystemError, ControlManager.GetSettingInfo().ErrorMessage);
            }
            return(JsonResult(result));
        }
Esempio n. 29
0
        /// <summary>
        /// 获取设备二维码信息
        /// </summary>
        /// <param name="id">设备编号</param>
        /// <returns>二维码信息</returns>
        public JsonResult EquipmentLabel(int id)
        {
            if (CheckSession() == false)
            {
                return(Json(ResultModelBase.CreateTimeoutModel(), JsonRequestBehavior.AllowGet));
            }
            if (CheckSessionID() == false)
            {
                return(Json(ResultModelBase.CreateLogoutModel(), JsonRequestBehavior.AllowGet));
            }

            ResultModel <string> result = new ResultModel <string>();

            try
            {
                result.Data = this.equipmentManager.GetEquipmentLabel(id, GetBaseUrl(), WebConfig.HOSPITAL_NAME);
            }
            catch (Exception ex)
            {
                NLog.LogManager.GetCurrentClassLogger().Error(ex, ex.Message);
                result.SetFailed(ResultCodes.SystemError, ControlManager.GetSettingInfo().ErrorMessage);
            }

            return(Json(result, JsonRequestBehavior.AllowGet));
        }
Esempio n. 30
0
        /// <summary>
        /// 获取预测工程师数量
        /// </summary>
        /// <returns>预测工程师数量</returns>
        public JsonResult GetComputeEngineer()
        {
            if (CheckSession() == false)
            {
                return(Json(ResultModelBase.CreateTimeoutModel(), JsonRequestBehavior.AllowGet));
            }
            if (CheckSessionID() == false)
            {
                return(Json(ResultModelBase.CreateLogoutModel(), JsonRequestBehavior.AllowGet));
            }

            ResultModel <int> result = new ResultModel <int>();

            try
            {
                this.valuationManager.UpdateEquipmentHours(GetLoginUser().ID);

                double           totalHours = this.valuationDao.GetTotalHours(GetLoginUser().ID);
                ValParameterInfo paraInfo   = this.valuationDao.GetParameter();

                result.Data = paraInfo.GetCalculatedEngineers(totalHours);
            }
            catch (Exception ex)
            {
                NLog.LogManager.GetCurrentClassLogger().Error(ex, ex.Message);
                result.SetFailed(ResultCodes.SystemError, ControlManager.GetSettingInfo().ErrorMessage);
            }
            return(JsonResult(result));
        }