/// <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="curRowNum">当前页数第一个数据的位置</param> /// <param name="pageSize">一页几条数据</param> /// <returns>作业报告列表</returns> public List <DispatchReportInfo> QueryDispatchReports(int status, int urgency, string filterField, string filterText, string sortField, bool sortDirection, int curRowNum = 0, int pageSize = 0) { List <DispatchReportInfo> dispatches = new List <DispatchReportInfo>(); sqlStr = "SELECT DISTINCT d.*,r.ID AS DispatchReportID , r.StatusID AS DispatchReportStatusID ,j.ID as DispatchJournalID, j.StatusID AS DispatchJournalStatusID " + " FROM tblDispatchReport r " + " LEFT JOIN tblDispatch d ON d.ID = r.DispatchID " + " LEFT JOIN tblDispatchJournal j ON d.ID = j.DispatchID " + " WHERE 1=1 "; if (status != 0) { sqlStr += " AND r.StatusID=" + status; } else { sqlStr += " AND r.StatusID <> " + DispatchReportInfo.DispatchReportStatus.Cancelled; } if (urgency != 0) { sqlStr += " AND d.UrgencyID=" + urgency; } if (!string.IsNullOrEmpty(filterText)) { sqlStr += GetFieldFilterClause(filterField); } sqlStr += GenerateSortClause(sortDirection, sortField, "r.ID"); sqlStr = AppendLimitClause(sqlStr, curRowNum, pageSize); using (SqlCommand command = ConnectionUtil.GetCommand(sqlStr)) { if (!String.IsNullOrEmpty(filterText)) { AddFieldFilterParam(command, filterField, filterText); } using (DataTable dt = GetDataTable(command)) { foreach (DataRow dr in dt.Rows) { DispatchReportInfo dispatchReport = new DispatchReportInfo(); dispatchReport.ID = SQLUtil.ConvertInt(dr["DispatchReportID"]); dispatchReport.Status.ID = SQLUtil.ConvertInt(dr["DispatchReportStatusID"]); dispatchReport.Status.Name = LookupManager.GetDispatchDocStatusDesc(dispatchReport.Status.ID); dispatchReport.Dispatch.ID = SQLUtil.ConvertInt(dr["ID"]); dispatchReport.Dispatch.Request.ID = SQLUtil.ConvertInt(dr["RequestID"]); dispatchReport.Dispatch.RequestType.ID = SQLUtil.ConvertInt(dr["RequestType"]); dispatchReport.Dispatch.RequestType.Name = LookupManager.GetRequestTypeDesc(dispatchReport.Dispatch.RequestType.ID); dispatchReport.Dispatch.Urgency.ID = SQLUtil.ConvertInt(dr["UrgencyID"]); dispatchReport.Dispatch.Urgency.Name = LookupManager.GetUrgencyDesc(dispatchReport.Dispatch.Urgency.ID); dispatchReport.Dispatch.ScheduleDate = SQLUtil.ConvertDateTime(dr["ScheduleDate"]); dispatchReport.Dispatch.EndDate = SQLUtil.ConvertDateTime(dr["EndDate"]); dispatches.Add(dispatchReport); } } } return(dispatches); }
/// <summary> /// 作业报告填写/审批/查看页面 /// </summary> /// <param name="actionName">父级页面名称</param> /// <param name="dispatchID">派工单编号</param> /// <param name="dispatchReportID">作业报告编号</param> /// <param name="dispatchJournalID">服务凭证编号</param> /// <param name="requestType">派工类型</param> /// <returns>作业报告填写/审批/查看页面</returns> public ActionResult DispatchReportDetail(string actionName = "", int dispatchID = 0, int dispatchReportID = 0, int dispatchJournalID = 0, int requestType = 0) { if (!CheckSession()) { Response.Redirect(Url.Action(ConstDefinition.HOME_ACTION, ConstDefinition.HOME_CONTROLLER), true); return(null); } ViewBag.ActionName = actionName; ViewBag.DispatchID = dispatchID; ViewBag.DispatchJournalID = dispatchJournalID; ViewBag.RequestType = requestType; if (dispatchReportID == 0) { int existsReportID = this.dispatchDao.GetDispatchByID(dispatchID).DispatchReport.ID; if (existsReportID == 0) { DispatchReportInfo dispatchReport = new DispatchReportInfo(); dispatchReport.Type = DispatchReportInfo.DispatchReportTypes.GetDispatchReportType(requestType); dispatchReport.Status.ID = DispatchReportInfo.DispatchReportStatus.New; dispatchReport.Status.Name = LookupManager.GetDispatchDocStatusDesc(dispatchReport.Status.ID); dispatchReport.Dispatch.ID = dispatchID; dispatchReportID = this.dispatchManager.SaveDispatchReport(dispatchReport, GetLoginUser()); } else { dispatchReportID = existsReportID; } } ViewBag.ID = dispatchReportID; return(View()); }
/// <summary> /// 获取作业报告信息 /// </summary> /// <param name="dr">The dr.</param> public DispatchReportInfo(DataRow dr) : this() { this.ID = SQLUtil.ConvertInt(dr["ID"]); this.Dispatch.ID = SQLUtil.ConvertInt(dr["DispatchID"]); this.Type.ID = SQLUtil.ConvertInt(dr["TypeID"]); this.Type = LookupManager.GetDispatchReportType(this.Type.ID); this.FaultCode = SQLUtil.TrimNull(dr["FaultCode"]); this.FaultDesc = SQLUtil.TrimNull(dr["FaultDesc"]); this.SolutionCauseAnalysis = SQLUtil.TrimNull(dr["SolutionCauseAnalysis"]); this.SolutionWay = SQLUtil.TrimNull(dr["SolutionWay"]); this.IsPrivate = SQLUtil.ConvertBoolean(dr["IsPrivate"]); this.ServiceProvider.ID = SQLUtil.ConvertInt(dr["ServiceProvider"]); this.ServiceProvider.Name = ServiceProviders.GetDescByID(this.ServiceProvider.ID); this.SolutionResultStatus.ID = SQLUtil.ConvertInt(dr["SolutionResultStatusID"]); this.SolutionResultStatus.Name = LookupManager.GetSolutionResultStatusDesc(this.SolutionResultStatus.ID); this.SolutionUnsolvedComments = SQLUtil.TrimNull(dr["SolutionUnsolvedComments"]); this.DelayReason = SQLUtil.TrimNull(dr["DelayReason"]); this.Comments = SQLUtil.TrimNull(dr["Comments"]); this.FujiComments = SQLUtil.TrimNull(dr["FujiComments"]); this.Status.ID = SQLUtil.ConvertInt(dr["StatusID"]); this.Status.Name = LookupManager.GetDispatchDocStatusDesc(this.Status.ID); this.PurchaseAmount = SQLUtil.ConvertDouble(dr["PurchaseAmount"]); this.ServiceScope = SQLUtil.ConvertBoolean(dr["ServiceScope"]); this.ServiceScope = SQLUtil.ConvertBoolean(dr["ServiceScope"]); this.Result = SQLUtil.TrimNull(dr["Result"]); this.IsRecall = SQLUtil.ConvertBoolean(dr["IsRecall"]); this.AcceptanceDate = SQLUtil.ConvertDateTime(dr["AcceptanceDate"]); this.EquipmentStatus.ID = SQLUtil.ConvertInt(dr["EquipmentStatus"]); this.EquipmentStatus.Name = MachineStatuses.GetMachineStatusesDesc(this.EquipmentStatus.ID); }
/// <summary> /// 获取服务凭证信息 /// </summary> /// <param name="dr">The dr.</param> public DispatchJournalInfo(DataRow dr) : this() { this.ID = SQLUtil.ConvertInt(dr["ID"]); this.Dispatch.ID = SQLUtil.ConvertInt(dr["DispatchID"]); this.FaultCode = SQLUtil.TrimNull(dr["FaultCode"]); this.JobContent = SQLUtil.TrimNull(dr["JobContent"]); this.FollowProblem = SQLUtil.TrimNull(dr["FollowProblem"]); this.Advice = SQLUtil.TrimNull(dr["Advice"]); this.UserName = SQLUtil.TrimNull(dr["UserName"]); this.UserMobile = SQLUtil.TrimNull(dr["UserMobile"]); this.Signed = SQLUtil.ConvertBoolean(dr["Signed"]); this.Status.ID = SQLUtil.ConvertInt(dr["StatusID"]); this.Status.Name = LookupManager.GetDispatchDocStatusDesc(this.Status.ID); this.ResultStatus.ID = SQLUtil.ConvertInt(dr["ResultStatusID"]); this.ResultStatus.Name = LookupManager.GetDispatchJournalResultStatusDesc(this.ResultStatus.ID); this.FujiComments = SQLUtil.TrimNull(dr["FujiComments"]); }
/// <summary> /// 获取派工单信息 /// </summary> /// <param name="dr">The dr.</param> public DispatchInfo(DataRow dr) : this() { this.ID = SQLUtil.ConvertInt(dr["ID"]); this.Request.ID = SQLUtil.ConvertInt(dr["RequestID"]); this.RequestType.ID = SQLUtil.ConvertInt(dr["RequestType"]); this.RequestType.Name = LookupManager.GetRequestTypeDesc(this.RequestType.ID); this.Urgency.ID = SQLUtil.ConvertInt(dr["UrgencyID"]); this.Urgency.Name = LookupManager.GetUrgencyDesc(this.Urgency.ID); this.MachineStatus.ID = SQLUtil.ConvertInt(dr["EquipmentStatus"]); this.MachineStatus.Name = MachineStatuses.GetMachineStatusesDesc(this.MachineStatus.ID); this.Engineer.ID = SQLUtil.ConvertInt(dr["EngineerID"]); this.ScheduleDate = SQLUtil.ConvertDateTime(dr["ScheduleDate"]); this.LeaderComments = SQLUtil.TrimNull(dr["LeaderComments"]); this.Status.ID = SQLUtil.ConvertInt(dr["StatusID"]); this.Status.Name = LookupManager.GetDispatchStatusDesc(this.Status.ID); this.CreateDate = SQLUtil.ConvertDateTime(dr["CreateDate"]); this.StartDate = SQLUtil.ConvertDateTime(dr["StartDate"]); this.EndDate = SQLUtil.ConvertDateTime(dr["EndDate"]); if (dr.Table.Columns.Contains("DispatchJournalID")) { this.DispatchJournal.ID = SQLUtil.ConvertInt(dr["DispatchJournalID"]); } if (dr.Table.Columns.Contains("DispatchJournalStatusID")) { this.DispatchJournal.Status.ID = SQLUtil.ConvertInt(dr["DispatchJournalStatusID"]); this.DispatchJournal.Status.Name = LookupManager.GetDispatchDocStatusDesc(this.DispatchJournal.Status.ID); } if (dr.Table.Columns.Contains("DispatchReportID")) { this.DispatchReport.ID = SQLUtil.ConvertInt(dr["DispatchReportID"]); } if (dr.Table.Columns.Contains("DispatchReportStatusID")) { this.DispatchReport.Status.ID = SQLUtil.ConvertInt(dr["DispatchReportStatusID"]); this.DispatchReport.Status.Name = LookupManager.GetDispatchDocStatusDesc(this.DispatchReport.Status.ID); } }