| | |
| | | |
| | | |
| | | |
| | | |
| | | /// <summary> |
| | | /// æ´æ°ç¶ææ¯å¦å
许è¿å
¥æ£ä¿® |
| | | /// </summary> |
| | | /// <param name="id"></param> |
| | | /// <param name="ispossible"></param> |
| | | /// <returns></returns> |
| | | public WebResponseContent RunOperation(int id, string ispossible) |
| | | { |
| | | try |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /// <summary> |
| | | /// çä»å¤©çæ£ä¿®ä»»å¡ |
| | | /// </summary> |
| | | /// <param name="id"></param> |
| | | /// <returns></returns> |
| | | public WebResponseContent MaintenanceTasksOfTheDay(string account) |
| | | { |
| | | try |
| | | { |
| | | var today = DateTime.Today; // ä»å¤©çé¶ç¹ |
| | | var tomorrow = today.AddDays(1); // æå¤©çé¶ç¹ |
| | | |
| | | var query = _user.Db.Queryable<Sys_User>() |
| | | .InnerJoin<Dt_Maintenance>((a, b) => a.UserName == b.UserAccount) |
| | | .Where((a, b) => b.IsPossible == "true" && b.UserAccount == account && |
| | | b.MaintenanceDate >= today && b.MaintenanceDate < tomorrow).Select((a, b) => new |
| | | { |
| | | b.ID, |
| | | a.UserTrueName, |
| | | a.UserName, |
| | | a.CardNumber, |
| | | a.Userteam, |
| | | a.HeadImageUrl, |
| | | b.IsPossible, |
| | | b.MaintenanceDate, |
| | | b.MaintenancStartTime, |
| | | b.MaintenancEendTime, |
| | | }).ToList(); |
| | | if (query==null) |
| | | { |
| | | return new WebResponseContent { Status = false, Message = "ä½ ä»å¤©æ²¡ææ£ä¿®ä»»å¡" }; |
| | | } |
| | | |
| | | |
| | | |
| | | return new WebResponseContent { Status=true, Data = query }; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | |
| | | return new WebResponseContent { Status = false, Message = "é误信æ¯ï¼" + ex.Message }; |
| | | } |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// å¼å§æ£ä¿® |
| | | /// </summary> |
| | | /// <param name="account"></param> |
| | | /// <returns></returns> |
| | | public WebResponseContent StartMaintenceTask(string account) |
| | | { |
| | | try |
| | | { |
| | | var today = DateTime.Today; // ä»å¤©çé¶ç¹ |
| | | var tomorrow = today.AddDays(1); // æå¤©çé¶ç¹ |
| | | |
| | | |
| | | var maint = BaseDal.QueryData(x => |
| | | x.UserAccount == account && |
| | | x.IsPossible == "true" && |
| | | x.MaintenanceDate >= today && |
| | | x.MaintenanceDate < tomorrow |
| | | ).FirstOrDefault(); |
| | | |
| | | if (maint == null) |
| | | { |
| | | return new WebResponseContent { Status = false, Message = "æªæ¾å°ä»æ¥çç»´æ¤ä»»å¡è®°å½" }; |
| | | } |
| | | |
| | | maint.MaintenancStartTime = DateTime.Now; |
| | | BaseDal.UpdateData(maint); |
| | | |
| | | return new WebResponseContent { Status = true, Data = maint }; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | return new WebResponseContent { Status = false, Message = "é误信æ¯ï¼" + ex.Message }; |
| | | } |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// ç»ææ£ä¿® |
| | | /// </summary> |
| | | /// <param name="account"></param> |
| | | /// <returns></returns> |
| | | public WebResponseContent StopMaintenanceTask(string account) |
| | | { |
| | | try |
| | | { |
| | | var today = DateTime.Today; // ä»å¤©çé¶ç¹ |
| | | var tomorrow = today.AddDays(1); // æå¤©çé¶ç¹ |
| | | |
| | | var maint = BaseDal.QueryData(x => x.UserAccount == account && x.IsPossible == "true" |
| | | && x.MaintenanceDate >= today &&x.MaintenanceDate < tomorrow).FirstOrDefault(); |
| | | if (maint == null) |
| | | { |
| | | return new WebResponseContent { Status = false, Message = "æªæ¾å°å¯ç¨çç»´æ¤ä»»å¡è®°å½" }; |
| | | } |
| | | // ä¿®æ¹å
¶ç»ææ¶é´ |
| | | maint.MaintenancEendTime = DateTime.Now; |
| | | maint.IsPossible = "ok";//okå°±ä»£è¡¨å®æäº |
| | | BaseDal.UpdateData(maint); |
| | | return new WebResponseContent { Status = true, Data = maint }; |
| | | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | |
| | | return new WebResponseContent { Status = false, Message = "é误信æ¯ï¼" + ex.Message }; |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /// <summary> |
| | | /// ç¶ææä¸¾ |