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)); }
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)); }
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)); }
/// <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)); }
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)); }
/// <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)); }
/// <summary> /// 设备查看页面 /// </summary> /// <param name="id">设备编号</param> /// <param name="actionName">上级页面名称</param> /// <returns>设备查看页面</returns> public ActionResult EquipmentView(int id, string actionName) { if (CheckSession() == false) { Response.Redirect(Url.Action(ConstDefinition.HOME_ACTION, ConstDefinition.HOME_CONTROLLER), true); return(null); } ResultModelBase result = new ResultModelBase(); try { ViewBag.Id = id; ViewBag.ActionName = actionName; return(View()); } catch (Exception ex) { NLog.LogManager.GetCurrentClassLogger().Error(ex, ex.Message); result.SetFailed(ResultCodes.SystemError, ControlManager.GetSettingInfo().ErrorMessage); } return(View("Error", result)); }
/// <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)); }
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)); }
/// <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)); }
/// <summary> /// 存入缓存 /// </summary> /// <param name="type">缓存类型</param> /// <returns>返回结果</returns> public JsonResult SaveValuation(ValuationType type) { if (CheckSession() == false) { return(Json(ResultModelBase.CreateTimeoutModel(), JsonRequestBehavior.AllowGet)); } if (CheckSessionID() == false) { return(Json(ResultModelBase.CreateLogoutModel(), JsonRequestBehavior.AllowGet)); } ResultModelBase result = new ResultModelBase(); try { switch (type) { case ValuationType.Equipment: var equipments = GetValSession <ValEquipmentInfo>(); if (equipments != null) { this.valuationManager.SaveValEquipments(GetLoginUser().ID, equipments.Values.ToList()); } break; case ValuationType.Spare: var spares = GetValSession <ValSpareInfo>(); if (spares != null) { this.valuationManager.SaveValSpares(spares.Values.ToList()); } break; case ValuationType.Consumable: var consumables = GetValSession <ValConsumableInfo>(); if (consumables != null) { this.valuationManager.SaveValConsumables(consumables.Values.ToList()); } break; case ValuationType.Component: case ValuationType.CTTube: var components = GetValSession <ValComponentInfo>(); if (components != null) { this.valuationManager.SaveValComponents(components.Values.ToList()); } break; } ClearValSession(); } catch (Exception ex) { NLog.LogManager.GetCurrentClassLogger().Error(ex, ex.Message); result.SetFailed(ResultCodes.SystemError, ControlManager.GetSettingInfo().ErrorMessage); } return(JsonResult(result)); }
public JsonResult ImportValEquipment(string base64String) { if (CheckSession() == false) { return(Json(ResultModelBase.CreateTimeoutModel(), JsonRequestBehavior.AllowGet)); } if (CheckSessionID() == false) { return(Json(ResultModelBase.CreateLogoutModel(), JsonRequestBehavior.AllowGet)); } ResultModelBase result = new ResultModelBase(); try { base64String = ParseBase64String(base64String); if (string.IsNullOrEmpty(base64String)) { result.SetFailed(ResultCodes.ParameterError, "上传文件为空"); } else { UserInfo user = GetLoginUser(); byte[] excelFile = Convert.FromBase64String(base64String); string message = null; List <ValEquipmentInfo> importEquipments = null; List <ValEquipmentInfo> updateEquipments = null; int parseResult = this.valuationManager.ParseImportFile(user.ID, excelFile, out message, out importEquipments, out updateEquipments); if (parseResult == 1) { result.SetFailed(ResultCodes.BusinessError, message); } else { this.valuationManager.SaveValEquipments(user.ID, updateEquipments, importEquipments); } } } catch (Exception ex) { NLog.LogManager.GetCurrentClassLogger().Error(ex, ex.Message); result.SetFailed(ResultCodes.SystemError, ControlManager.GetSettingInfo().ErrorMessage); } return(Json(result, JsonRequestBehavior.AllowGet)); }
/// <summary> /// 导出日志列表 /// </summary> /// <param name="objectTypeID">角色ID</param> /// <param name="filterField">搜索字段</param> /// <param name="filterText">搜索框填写内容</param> /// <param name="field">排序字段</param> /// <param name="direction">排序方式</param> /// <param name="startDate">请求开始日期</param> /// <param name="endDate">请求结束日期</param> /// <returns>日志列表excel</returns> public ActionResult ExportSysAuditLogList(int objectTypeID, string filterField, string filterText, string field, bool direction, string startDate, string endDate) { if (CheckSession() == false) { return(Json(ResultModelBase.CreateTimeoutModel(), JsonRequestBehavior.AllowGet)); } if (CheckSessionID() == false) { return(Json(ResultModelBase.CreateLogoutModel(), JsonRequestBehavior.AllowGet)); } ResultModelBase result = new ResultModelBase(); try { DateTime _startDate = (DateTime)SqlDateTime.MinValue; DateTime _endDate = DateTime.Now; BaseDao.ProcessFieldFilterValue(filterField, ref filterText); if (!string.IsNullOrEmpty(startDate)) { _startDate = Convert.ToDateTime(startDate); } if (!string.IsNullOrEmpty(endDate)) { _endDate = Convert.ToDateTime(endDate); } UserInfo userInfo = GetLoginUser(); List <AuditHdrInfo> infos = this.auditLogDao.QuerySysAuditLogs(objectTypeID, filterField, filterText, field, direction, _startDate, _endDate, 0, 0); DataTable dt = new DataTable("Sheet1"); dt.Columns.Add("系统编号"); dt.Columns.Add("用户姓名"); dt.Columns.Add("操作时间"); dt.Columns.Add("操作类型"); dt.Columns.Add("对象类型"); dt.Columns.Add("对象系统编号"); foreach (AuditHdrInfo info in infos) { dt.Rows.Add(info.OID, info.TransUser.Name, info.UpdateDate.ToString("yyyy-MM-dd"), info.Operation.Name, info.ObjectType.Name, info.ObjectOID); } MemoryStream ms = ExportUtil.ToExcel(dt); Response.AddHeader("Set-Cookie", "fileDownload=true; path=/"); return(File(ms, "application/excel", "日志列表.xlsx")); } catch (Exception ex) { NLog.LogManager.GetCurrentClassLogger().Error(ex, ex.Message); result.SetFailed(ResultCodes.SystemError, ControlManager.GetSettingInfo().ErrorMessage); } return(JsonResult(result)); }
public ActionResult ViewPDF(int equipmentID, int fileID) { if (CheckSession() == false) { return(Json(ResultModelBase.CreateTimeoutModel(), JsonRequestBehavior.AllowGet)); } if (CheckSessionID() == false) { return(Json(ResultModelBase.CreateLogoutModel(), JsonRequestBehavior.AllowGet)); } ResultModelBase result = new ResultModelBase(); try { UploadFileInfo info = this.fileDao.GetFileByID(ObjectTypes.Equipment, fileID); FileUtil.CheckDirectory(Constants.EquipmentFolder); string filePath = Path.Combine(Constants.EquipmentFolder, string.Format("{0}_{1}{2}", equipmentID, fileID, new FileInfo(info.FileName).Extension)); if (info != null && System.IO.File.Exists(filePath)) { Stream stream = new FileStream(filePath, FileMode.Open); return(File(stream, info.FileName)); } else { result.SetFailed(ResultCodes.BusinessError, "文件不存在"); } } catch (Exception ex) { NLog.LogManager.GetCurrentClassLogger().Error(ex, ex.Message); result.SetFailed(ResultCodes.SystemError, ControlManager.GetSettingInfo().ErrorMessage); } return(View("ErrorPage", null, result.ResultMessage)); }
/// <summary> /// 导出派工单列表 /// </summary> /// <param name="status">派工单状态</param> /// <param name="urgency">派工单紧急程度</param> /// <param name="type">派工类型</param> /// <param name="filterField">搜索字段</param> /// <param name="filterText">搜索框填写内容</param> /// <param name="sortField">排序字段</param> /// <param name="sortDirection">排序方式</param> /// <returns>派工单列表的excel</returns> public ActionResult ExportDispatches(int status, int urgency, int type, string filterField, string filterText, string sortField, bool sortDirection) { if (CheckSession() == false) { return(Json(ResultModelBase.CreateTimeoutModel(), JsonRequestBehavior.AllowGet)); } if (CheckSessionID() == false) { return(Json(ResultModelBase.CreateLogoutModel(), JsonRequestBehavior.AllowGet)); } ResultModelBase result = new ResultModelBase(); try { UserInfo userInfo = new UserInfo(); userInfo = GetLoginUser(); List <DispatchInfo> dispatches = null; BaseDao.ProcessFieldFilterValue(filterField, ref filterText); dispatches = this.dispatchManager.QueryDispatches(userInfo.ID, userInfo.Role.ID, status, urgency, type, filterField, filterText, sortField, sortDirection, 0, 0); DataTable dt = new DataTable("Sheet1"); dt.Columns.Add("派工单编号"); dt.Columns.Add("请求编号"); dt.Columns.Add("设备系统编号"); dt.Columns.Add("设备名称"); dt.Columns.Add("派工类型"); dt.Columns.Add("紧急程度"); dt.Columns.Add("派工日期"); dt.Columns.Add("结束日期"); dt.Columns.Add("状态"); foreach (DispatchInfo dispatch in dispatches) { dt.Rows.Add(dispatch.OID, dispatch.Request.OID, dispatch.Request.EquipmentOID, dispatch.Request.EquipmentName, dispatch.RequestType.Name, dispatch.Urgency.Name, dispatch.ScheduleDate.ToString("yyyy-MM-dd"), dispatch.EndDate == DateTime.MinValue ? "" : dispatch.EndDate.ToString("yyyy-MM-dd"), dispatch.Status.Name); } MemoryStream ms = ExportUtil.ToExcel(dt); Response.AddHeader("Set-Cookie", "fileDownload=true; path=/"); return(File(ms, "application/excel", "派工单.xlsx")); } catch (Exception ex) { NLog.LogManager.GetCurrentClassLogger().Error(ex, ex.Message); result.SetFailed(ResultCodes.SystemError, ControlManager.GetSettingInfo().ErrorMessage); } return(Json(result, JsonRequestBehavior.AllowGet)); }
public JsonResult ForgetPassword(string loginID) { ResultModelBase result = new ResultModelBase(); try { UserInfo existingInfo = this.userManager.GetUserByLoginID(loginID); if (existingInfo == null) { result.SetFailed(ResultCodes.BusinessError, "用户尚未注册"); } else if (string.IsNullOrEmpty(existingInfo.Email)) { result.SetFailed(ResultCodes.BusinessError, "无邮箱账号,请联系管理员"); } else if (existingInfo.IsActive == false) { result.SetFailed(ResultCodes.BusinessError, "用户已停用"); } else if (existingInfo.VerifyStatus.ID != BusinessObjects.Domain.VerifyStatus.Pass) { result.SetFailed(ResultCodes.BusinessError, "用户尚未通过审批"); } else { SendNoticeEmail(existingInfo); } } catch (Exception ex) { NLog.LogManager.GetCurrentClassLogger().Error(ex, ex.Message); result.SetFailed(ResultCodes.SystemError, ControlManager.GetSettingInfo().ErrorMessage); } return(JsonResult(result)); }
public ActionResult ExportContracts(int status, string filterField, string filterText, string sortField, bool sortDirection) { if (CheckSession() == false) { return(Json(ResultModelBase.CreateTimeoutModel(), JsonRequestBehavior.AllowGet)); } if (CheckSessionID() == false) { return(Json(ResultModelBase.CreateLogoutModel(), JsonRequestBehavior.AllowGet)); } ResultModelBase result = new ResultModelBase(); try { List <ContractInfo> contracts = null; BaseDao.ProcessFieldFilterValue(filterField, ref filterText); contracts = this.contractManager.QueryContracts(status, filterField, filterText, sortField, sortDirection); DataTable dt = new DataTable("Sheet1"); dt.Columns.Add("系统编号"); dt.Columns.Add("合同编号"); dt.Columns.Add("设备编号"); dt.Columns.Add("设备序列号"); dt.Columns.Add("合同名称"); dt.Columns.Add("合同类型"); dt.Columns.Add("供应商"); dt.Columns.Add("开始时间"); dt.Columns.Add("结束时间"); dt.Columns.Add("状态"); foreach (ContractInfo contract in contracts) { dt.Rows.Add(contract.OID, contract.ContractNum, contract.EquipmentOID, contract.EquipmentSerialCode, contract.Name, contract.Type.Name, contract.Supplier.Name, contract.StartDate.ToString("yyyy-MM-dd"), contract.EndDate.ToString("yyyy-MM-dd"), contract.Status); } MemoryStream ms = ExportUtil.ToExcel(dt); Response.AddHeader("Set-Cookie", "fileDownload=true; path=/"); return(File(ms, "application/excel", "合同列表.xlsx")); } catch (Exception ex) { NLog.LogManager.GetCurrentClassLogger().Error(ex, ex.Message); result.SetFailed(ResultCodes.SystemError, ControlManager.GetSettingInfo().ErrorMessage); } return(Json(result, JsonRequestBehavior.AllowGet)); }
/// <summary> /// 导出服务信息 /// </summary> /// <param name="statusID">状态</param> /// <param name="filterField">搜索字段</param> /// <param name="filterText">搜索内容</param> /// <param name="sortField">排序字段</param> /// <param name="sortDirection">排序方式</param> /// <returns>服务列表excel</returns> public ActionResult ExportServices(int statusID, string filterField, string filterText, string sortField, bool sortDirection, int fujiClass2ID = 0) { if (CheckSession() == false) { return(Json(ResultModelBase.CreateTimeoutModel(), JsonRequestBehavior.AllowGet)); } if (CheckSessionID() == false) { return(Json(ResultModelBase.CreateLogoutModel(), JsonRequestBehavior.AllowGet)); } ResultModelBase result = new ResultModelBase(); try { BaseDao.ProcessFieldFilterValue(filterField, ref filterText); List <InvServiceInfo> invServices = this.invServiceDao.QueryServices(statusID, filterField, filterText, sortField, sortDirection, 0, 0, fujiClass2ID); DataTable dt = new DataTable("Sheet1"); dt.Columns.Add("系统编号"); dt.Columns.Add("服务名称"); dt.Columns.Add("关联富士II类"); dt.Columns.Add("供应商"); dt.Columns.Add("服务次数"); dt.Columns.Add("服务开始日期"); dt.Columns.Add("服务结束日期"); dt.Columns.Add("金额"); dt.Columns.Add("剩余服务次数"); dt.Columns.Add("采购单号"); dt.Columns.Add("状态"); foreach (InvServiceInfo invService in invServices) { dt.Rows.Add(invService.OID, invService.Name, invService.FujiClass2.Name, invService.Supplier.Name, invService.TotalTimes, invService.AddDate.ToString("yyyy-MM-dd"), invService.EndDate.ToString("yyyy-MM-dd"), invService.Price, invService.AvaibleTimes, invService.Purchase.ID == 0 ? "" : invService.Purchase.Name, invService.Status); } MemoryStream ms = ExportUtil.ToExcel(dt); Response.AddHeader("Set-Cookie", "fileDownload=true; path=/"); return(File(ms, "application/excel", "服务库列表.xlsx")); } catch (Exception ex) { NLog.LogManager.GetCurrentClassLogger().Error(ex, ex.Message); result.SetFailed(ResultCodes.SystemError, ControlManager.GetSettingInfo().ErrorMessage); } return(Json(result, JsonRequestBehavior.AllowGet)); }
/// <summary> /// 导出零件信息 /// </summary> /// <param name="statusID">状态</param> /// <param name="filterField">搜索字段</param> /// <param name="filterText">搜索内容</param> /// <param name="sortField">排序字段</param> /// <param name="sortDirection">排序方式</param> /// <returns>零件列表excel</returns> public ActionResult ExportComponents(int statusID, string filterField, string filterText, string sortField, bool sortDirection, string eqptID = "") { if (CheckSession() == false) { return(Json(ResultModelBase.CreateTimeoutModel(), JsonRequestBehavior.AllowGet)); } if (CheckSessionID() == false) { return(Json(ResultModelBase.CreateLogoutModel(), JsonRequestBehavior.AllowGet)); } ResultModelBase result = new ResultModelBase(); try { List <InvComponentInfo> invComponents = this.invComponentDao.QueryComponents(statusID, filterField, filterText, sortField, sortDirection, 0, 0, eqptID); DataTable dt = new DataTable("Sheet1"); dt.Columns.Add("系统编号"); dt.Columns.Add("序列号"); dt.Columns.Add("简称"); dt.Columns.Add("描述"); dt.Columns.Add("类型"); dt.Columns.Add("设备系统编号"); dt.Columns.Add("设备名称"); dt.Columns.Add("供应商"); dt.Columns.Add("单价(元)"); dt.Columns.Add("购入日期"); dt.Columns.Add("采购单号"); dt.Columns.Add("状态"); foreach (InvComponentInfo invComponent in invComponents) { dt.Rows.Add(invComponent.OID, invComponent.SerialCode, invComponent.Component.Name, invComponent.Component.Description, invComponent.Component.Type.Name, invComponent.Equipment.OID, invComponent.Equipment.Name, invComponent.Supplier.Name, invComponent.Price, invComponent.PurchaseDate.ToString("yyyy-MM-dd"), invComponent.Purchase.ID == 0 ? "" : invComponent.Purchase.Name, invComponent.Status.Name); } MemoryStream ms = ExportUtil.ToExcel(dt); Response.AddHeader("Set-Cookie", "fileDownload=true; path=/"); return(File(ms, "application/excel", "零件库列表.xlsx")); } catch (Exception ex) { NLog.LogManager.GetCurrentClassLogger().Error(ex, ex.Message); result.SetFailed(ResultCodes.SystemError, ControlManager.GetSettingInfo().ErrorMessage); } return(Json(result, JsonRequestBehavior.AllowGet)); }
/// <summary> /// 导出耗材信息 /// </summary> /// <param name="fujiClass2ID">富士II类ID</param> /// <param name="filterField">搜索字段</param> /// <param name="filterText">搜索内容</param> /// <param name="sortField">排序字段</param> /// <param name="sortDirection">排序方式</param> /// <returns>耗材列表excel</returns> public ActionResult ExportConsumables(int fujiClass2ID, string filterField, string filterText, string sortField, bool sortDirection) { if (CheckSession() == false) { return(Json(ResultModelBase.CreateTimeoutModel(), JsonRequestBehavior.AllowGet)); } if (CheckSessionID() == false) { return(Json(ResultModelBase.CreateLogoutModel(), JsonRequestBehavior.AllowGet)); } ResultModelBase result = new ResultModelBase(); try { List <InvConsumableInfo> invConsumables = this.invConsumableDao.QueryConsumables(fujiClass2ID, filterField, filterText, sortField, sortDirection, 0, 0); DataTable dt = new DataTable("Sheet1"); dt.Columns.Add("系统编号"); dt.Columns.Add("批次号"); dt.Columns.Add("简称"); dt.Columns.Add("描述"); dt.Columns.Add("供应商"); dt.Columns.Add("富士II类"); dt.Columns.Add("单价(元)"); dt.Columns.Add("购入日期"); dt.Columns.Add("采购单号"); dt.Columns.Add("数量"); foreach (InvConsumableInfo invConsumable in invConsumables) { dt.Rows.Add(invConsumable.OID, invConsumable.LotNum, invConsumable.Consumable.Name, invConsumable.Consumable.Description, invConsumable.Supplier.Name, invConsumable.Consumable.FujiClass2.Name, invConsumable.Price, invConsumable.PurchaseDate.ToString("yyyy-MM-dd"), invConsumable.Purchase.ID == 0 ? "" : invConsumable.Purchase.Name, invConsumable.AvaibleQty); } MemoryStream ms = ExportUtil.ToExcel(dt); Response.AddHeader("Set-Cookie", "fileDownload=true; path=/"); return(File(ms, "application/excel", "耗材库列表.xlsx")); } catch (Exception ex) { NLog.LogManager.GetCurrentClassLogger().Error(ex, ex.Message); result.SetFailed(ResultCodes.SystemError, ControlManager.GetSettingInfo().ErrorMessage); } return(Json(result, JsonRequestBehavior.AllowGet)); }
public ActionResult RunCustRpt(CustomReportInfo info, string field, DateTime startTime, DateTime endTime) { if (CheckSession() == false) { return(Json(ResultModelBase.CreateTimeoutModel(), JsonRequestBehavior.AllowGet)); } if (CheckSessionID() == false) { return(Json(ResultModelBase.CreateLogoutModel(), JsonRequestBehavior.AllowGet)); } ResultModelBase result = new ResultModelBase(); try { endTime = endTime.AddDays(1); DataTable infoList = new DataTable(); if (info.Type.ID == CustomReportInfo.CustRptType.Equipment) { infoList = this.customRptManager.QueryCustRpt4Equipment(info, field, startTime, endTime); } if (info.Type.ID == CustomReportInfo.CustRptType.Contract) { infoList = this.customRptManager.QueryCustRpt4Contract(info, field, startTime, endTime); } if (info.Type.ID == CustomReportInfo.CustRptType.Request) { infoList = this.customRptManager.QueryCustRpt4Request(info, field, startTime, endTime); } if (info.Type.ID == CustomReportInfo.CustRptType.Dispatch) { infoList = this.customRptManager.QueryCustRpt4Dispatch(info, field, startTime, endTime); } MemoryStream ms = ExportUtil.ToExcel(infoList); Response.AddHeader("Set-Cookie", "fileDownload=true; path=/"); return(File(ms, "application/excel", info.Name + ".xlsx")); } catch (Exception ex) { NLog.LogManager.GetCurrentClassLogger().Error(ex, ex.Message); result.SetFailed(ResultCodes.SystemError, ControlManager.GetSettingInfo().ErrorMessage); } return(Json(result, JsonRequestBehavior.AllowGet)); }
public ActionResult ExportFujiClass2s(int class1, int class2, string filterField, string filterText, string sortField, bool sortDirection) { if (CheckSession() == false) { return(Json(ResultModelBase.CreateTimeoutModel(), JsonRequestBehavior.AllowGet)); } if (CheckSessionID() == false) { return(Json(ResultModelBase.CreateLogoutModel(), JsonRequestBehavior.AllowGet)); } ResultModelBase result = new ResultModelBase(); try { List <FujiClass2Info> fujiClass2s = this.fujiClassManager.QueryFujiClass2s(class1, class2, filterField, filterText, sortField, sortDirection); DataTable dt = new DataTable("Sheet1"); dt.Columns.Add("富士I类"); dt.Columns.Add("富士II类简称"); dt.Columns.Add("富士II类描述"); dt.Columns.Add("人工费"); dt.Columns.Add("维保服务费"); dt.Columns.Add("备用机成本"); dt.Columns.Add("维保额外维修费"); dt.Columns.Add("零件"); dt.Columns.Add("耗材"); foreach (FujiClass2Info fujiClass2 in fujiClass2s) { dt.Rows.Add(fujiClass2.FujiClass1.Name, fujiClass2.Name, fujiClass2.Description, fujiClass2.IncludeLabour?"有":"无", fujiClass2.IncludeContract ? "有" : "无", fujiClass2.IncludeSpare ? "有" : "无", fujiClass2.IncludeRepair ? "有" : "无", (fujiClass2.Components != null && fujiClass2.Components.Count > 0)?"有" : "无", (fujiClass2.Consumables != null && fujiClass2.Consumables.Count > 0)?"有" : "无"); } MemoryStream ms = ExportUtil.ToExcel(dt); Response.AddHeader("Set-Cookie", "fileDownload=true; path=/"); return(File(ms, "application/excel", "富士II类列表.xlsx")); } catch (Exception ex) { NLog.LogManager.GetCurrentClassLogger().Error(ex, ex.Message); result.SetFailed(ResultCodes.SystemError, ControlManager.GetSettingInfo().ErrorMessage); } return(Json(result, JsonRequestBehavior.AllowGet)); }
/// <summary> /// 导出耗材列表 /// </summary> /// <param name="statusID">耗材状态</param> /// <param name="filterField">搜索字段</param> /// <param name="filterText">搜索内容</param> /// <returns>耗材定义excel</returns> public ActionResult ExportConsumables(int statusID, string filterField, string filterText) { if (CheckSession() == false) { return(Json(ResultModelBase.CreateTimeoutModel(), JsonRequestBehavior.AllowGet)); } if (CheckSessionID() == false) { return(Json(ResultModelBase.CreateLogoutModel(), JsonRequestBehavior.AllowGet)); } ResultModelBase result = new ResultModelBase(); try { List <ConsumableInfo> consumables = this.consumableDao.QueryConsumables(statusID, filterField, filterText, 0, 0); DataTable dt = new DataTable("Sheet1"); dt.Columns.Add("富士II类"); dt.Columns.Add("简称"); dt.Columns.Add("描述"); dt.Columns.Add("类型"); dt.Columns.Add("标准单价(元)"); dt.Columns.Add("是否参与估值"); dt.Columns.Add("更换频率(次/年)"); dt.Columns.Add("单次保养耗材成本(元)"); dt.Columns.Add("状态"); foreach (ConsumableInfo consumable in consumables) { dt.Rows.Add(consumable.FujiClass2.Name, consumable.Name, consumable.Description, consumable.Type.Name, consumable.StdPrice, consumable.IsIncluded ? "是" : "否", consumable.ReplaceTimes, consumable.CostPer, consumable.IsActive ? "启用" : "停用"); } MemoryStream ms = ExportUtil.ToExcel(dt); Response.AddHeader("Set-Cookie", "fileDownload=true; path=/"); return(File(ms, "application/excel", "耗材定义列表.xlsx")); } catch (Exception ex) { NLog.LogManager.GetCurrentClassLogger().Error(ex, ex.Message); result.SetFailed(ResultCodes.SystemError, ControlManager.GetSettingInfo().ErrorMessage); } return(Json(result, JsonRequestBehavior.AllowGet)); }
public ActionResult ExportCustRpt(int typeID, string filterField, string filterText) { if (CheckSession() == false) { return(Json(ResultModelBase.CreateTimeoutModel(), JsonRequestBehavior.AllowGet)); } if (CheckSessionID() == false) { return(Json(ResultModelBase.CreateLogoutModel(), JsonRequestBehavior.AllowGet)); } ResultModelBase result = new ResultModelBase(); try { BaseDao.ProcessFieldFilterValue(filterField, ref filterText); List <CustomReportInfo> CustRpts = this.customRptDao.QueryCustRptsList(typeID, filterField, filterText, 0, 0); DataTable dt = new DataTable("Sheet1"); dt.Columns.Add("编号"); dt.Columns.Add("类别"); dt.Columns.Add("名称"); dt.Columns.Add("创建人"); dt.Columns.Add("创建日期"); dt.Columns.Add("更改日期"); dt.Columns.Add("上次运行日期"); foreach (CustomReportInfo custRpt in CustRpts) { dt.Rows.Add(custRpt.OID, custRpt.Type.Name, custRpt.Name, custRpt.CreateUser.Name, custRpt.CreatedDate.ToString("yyyy-MM-dd"), custRpt.UpdateDate == DateTime.MinValue ? "" : custRpt.UpdateDate.ToString("yyyy-MM-dd"), custRpt.LastRunDate == DateTime.MinValue ? "" : custRpt.LastRunDate.ToString("yyyy-MM-dd")); } MemoryStream ms = ExportUtil.ToExcel(dt); Response.AddHeader("Set-Cookie", "fileDownload=true; path=/"); return(File(ms, "application/excel", "自定义报表列表.xlsx")); } catch (Exception ex) { NLog.LogManager.GetCurrentClassLogger().Error(ex, ex.Message); result.SetFailed(ResultCodes.SystemError, ControlManager.GetSettingInfo().ErrorMessage); } return(Json(result, JsonRequestBehavior.AllowGet)); }
/// <summary> /// 导出采购单信息 /// </summary> /// <param name="statusID">状态</param> /// <param name="filterField">搜索字段</param> /// <param name="filterText">搜索内容</param> /// <param name="sortField">排序字段</param> /// <param name="sortDirection">排序方式</param> /// <returns>采购单列表excel</returns> public ActionResult ExportPurchaseOrders(int statusID, string filterField, string filterText, string sortField, bool sortDirection) { if (CheckSession() == false) { return(Json(ResultModelBase.CreateTimeoutModel(), JsonRequestBehavior.AllowGet)); } if (CheckSessionID() == false) { return(Json(ResultModelBase.CreateLogoutModel(), JsonRequestBehavior.AllowGet)); } ResultModelBase result = new ResultModelBase(); try { BaseDao.ProcessFieldFilterValue(filterField, ref filterText); List <PurchaseOrderInfo> purchaseOrders = this.purchaseOrderDao.QueryPurchaseOrders(statusID, filterField, filterText, sortField, sortDirection, 0, 0); DataTable dt = new DataTable("Sheet1"); dt.Columns.Add("系统编号"); dt.Columns.Add("请求人"); dt.Columns.Add("供应商"); dt.Columns.Add("采购日期"); dt.Columns.Add("到货日期"); dt.Columns.Add("状态"); foreach (PurchaseOrderInfo purchaseOrder in purchaseOrders) { dt.Rows.Add(purchaseOrder.OID, purchaseOrder.User.Name, purchaseOrder.Supplier.Name, purchaseOrder.OrderDate.ToString("yyyy-MM-dd"), purchaseOrder.DueDate.ToString("yyyy-MM-dd"), purchaseOrder.Status.Name); } MemoryStream ms = ExportUtil.ToExcel(dt); Response.AddHeader("Set-Cookie", "fileDownload=true; path=/"); return(File(ms, "application/excel", "采购单列表.xlsx")); } catch (Exception ex) { NLog.LogManager.GetCurrentClassLogger().Error(ex, ex.Message); result.SetFailed(ResultCodes.SystemError, ControlManager.GetSettingInfo().ErrorMessage); } return(Json(result, JsonRequestBehavior.AllowGet)); }
/// <summary> /// 扫码报修 /// </summary> /// <param name="id">设备编号</param> /// <returns>扫码报修页面</returns> public ActionResult Repair(int id) { ResultModelBase result = new ResultModelBase(); try { EquipmentInfo info = this.equipmentManager.GetEquipment(id); if (info == null) { return(View("Error", result)); } return(View("Repair", info)); } catch (Exception ex) { NLog.LogManager.GetCurrentClassLogger().Error(ex, ex.Message); result.SetFailed(ResultCodes.SystemError, ControlManager.GetSettingInfo().ErrorMessage); } return(View("Error", result)); }
/// <summary> /// 导出富士类别 /// </summary> /// <param name="EquipmentClass1Name">设备类别1</param> /// <param name="EquipmentClass2Name">设备类别2</param> /// <param name="FujiClass1ID">富士I类id</param> /// <param name="FujiClass2ID">富士II类id</param> /// <returns>零件列表excel</returns> public ActionResult ExportFujiClass(string EquipmentClass1Name, string EquipmentClass2Name, int FujiClass1ID, int FujiClass2ID) { if (CheckSession() == false) { return(Json(ResultModelBase.CreateTimeoutModel(), JsonRequestBehavior.AllowGet)); } if (CheckSessionID() == false) { return(Json(ResultModelBase.CreateLogoutModel(), JsonRequestBehavior.AllowGet)); } ResultModelBase result = new ResultModelBase(); try { List <FujiClassLink> infos = this.fujiClassDao.QueryFujiClass(EquipmentClass1Name, EquipmentClass2Name, FujiClass1ID, FujiClass2ID); DataTable dt = new DataTable("Sheet1"); dt.Columns.Add("设备类型I简称"); dt.Columns.Add("设备类型II简称"); dt.Columns.Add("富士I类简称"); dt.Columns.Add("富士II类简称"); foreach (FujiClassLink info in infos) { dt.Rows.Add(info.EquipmentType1.Description, info.EquipmentType2.Description, info.FujiClass2.FujiClass1.Name, info.FujiClass2.Name); } MemoryStream ms = ExportUtil.ToExcel(dt); Response.AddHeader("Set-Cookie", "fileDownload=true; path=/"); return(File(ms, "application/excel", "富士类别.xlsx")); } catch (Exception ex) { NLog.LogManager.GetCurrentClassLogger().Error(ex, ex.Message); result.SetFailed(ResultCodes.SystemError, ControlManager.GetSettingInfo().ErrorMessage); } return(Json(result, JsonRequestBehavior.AllowGet)); }
public JsonResult DeleteConsumableByID(int consumableID) { if (CheckSession(false) == false) { return(Json(ResultModelBase.CreateTimeoutModel(), JsonRequestBehavior.AllowGet)); } if (CheckSessionID() == false) { return(Json(ResultModelBase.CreateLogoutModel(), JsonRequestBehavior.AllowGet)); } ResultModelBase result = new ResultModelBase(); try { this.consumableDao.DeleteConsumableByID(consumableID); } catch (Exception ex) { NLog.LogManager.GetCurrentClassLogger().Error(ex, ex.Message); result.SetFailed(ResultCodes.SystemError, ControlManager.GetSettingInfo().ErrorMessage); } return(JsonResult(result)); }
public JsonResult UpdateSelectiveDate(RequestInfo info) { ResultModelBase result = new ResultModelBase(); if (CheckSession(false) == false) { return(Json(ResultModelBase.CreateTimeoutModel(), JsonRequestBehavior.AllowGet)); } if (CheckSessionID() == false) { return(Json(ResultModelBase.CreateLogoutModel(), JsonRequestBehavior.AllowGet)); } try { this.requestManager.UpdateSelectiveDate(info.ID, info.SelectiveDate); } catch (Exception ex) { NLog.LogManager.GetCurrentClassLogger().Error(ex, ex.Message); result.SetFailed(ResultCodes.SystemError, ControlManager.GetSettingInfo().ErrorMessage); } return(JsonResult(result)); }
public JsonResult EndPurchaseOrder(int purchaseOrderID, string comments = "") { ResultModelBase result = new ResultModelBase(); if (CheckSession() == false) { return(Json(ResultModelBase.CreateTimeoutModel(), JsonRequestBehavior.AllowGet)); } if (CheckSessionID() == false) { return(Json(ResultModelBase.CreateLogoutModel(), JsonRequestBehavior.AllowGet)); } try { this.purchaseOrderManager.EndPurchaseOrder(purchaseOrderID, GetLoginUser(), comments); } catch (Exception ex) { NLog.LogManager.GetCurrentClassLogger().Error(ex, ex.Message); result.SetFailed(ResultCodes.SystemError, ControlManager.GetSettingInfo().ErrorMessage); } return(JsonResult(result)); }