using System;
|
using System.Collections.Generic;
|
using System.Linq;
|
using System.Text;
|
using System.Threading.Tasks;
|
using AutoMapper;
|
using SqlSugar;
|
using WIDESEAWCS_Core;
|
using WIDESEAWCS_Core.BaseRepository;
|
using WIDESEAWCS_Core.BaseServices;
|
using WIDESEAWCS_ITelescopicService;
|
using WIDESEAWCS_Model.Models;
|
using WIDESEAWCS_DTO;
|
using OfficeOpenXml.FormulaParsing.Excel.Functions.DateTime;
|
using WIDESEAWCS_DTO.Telescopic;
|
using SqlSugar.DistributedSystem.Snowflake;
|
using System.IO;
|
|
namespace WIDESEAWCS_TelescopicService
|
{
|
public class MaintenanceService : ServiceBase<Dt_Maintenance, IRepository<Dt_Maintenance>>, IMaintenanceService
|
{
|
public IRepository<Dt_Maintenance> Repository => BaseDal;
|
public readonly IRepository<Dt_MaintenanceTeam> _team;
|
private readonly IRepository<Sys_User> _user;
|
|
|
public MaintenanceService(IRepository<Dt_Maintenance> BaseDal, IRepository<Sys_User> user, IRepository<Dt_MaintenanceTeam> team) : base(BaseDal)
|
{
|
_user = user;
|
_team = team;
|
|
}
|
|
|
|
/// <summary>
|
/// 设置检修权限
|
/// </summary>
|
/// <param name="pagination"></param>
|
/// <returns></returns>
|
public WebResponseContent ShowMaintence(PaginationDTO pagination)
|
{
|
try
|
{
|
int totalCount = 0;
|
var sys = _user.Db.Queryable<Sys_User>().Where(x=>x.Enable==1);
|
var main = Db.Queryable<Dt_Maintenance>();
|
|
var query = sys.InnerJoin<Dt_Maintenance>((a, b) => a.UserName == b.UserAccount);
|
|
// 筛选搜索关键字(无论admin还是普通用户都适用)
|
if (!string.IsNullOrEmpty(pagination.searchKeyword))
|
{
|
query = query.Where((a, b) =>
|
a.UserTrueName.Contains(pagination.searchKeyword) ||
|
a.UserName.Contains(pagination.searchKeyword) ||
|
a.CardNumber.ToString().Contains(pagination.searchKeyword) ||
|
a.Userteam.Contains(pagination.searchKeyword)
|
);
|
}
|
|
// 如果不是管理员,根据部门过滤
|
if (pagination.account != "admin")
|
{
|
var currentUser = _user.Db.Queryable<Sys_User>()
|
.Where(u => u.UserName == pagination.account)
|
.First();
|
|
if (currentUser == null)
|
{
|
return new WebResponseContent { Status = false, Data = "未获取到用户信息" };
|
}
|
|
int? deptId = currentUser.Dept_Id;
|
|
query = query.Where((a, b) => a.Dept_Id == deptId);
|
}
|
// 执行分页查询
|
var result = query.Select((a, b) => new
|
{
|
b.ID,
|
a.UserTrueName,
|
a.UserName,
|
a.CardNumber,
|
a.Userteam,
|
a.HeadImageUrl,
|
b.IsPossible
|
}).ToPageList(pagination.pageIndex, pagination.pageSize, ref totalCount);
|
|
return new WebResponseContent
|
{
|
Status = true,
|
Data = new
|
{
|
TotalCount = totalCount,
|
PageIndex = pagination.pageIndex,
|
PageSize = pagination.pageSize,
|
Items = result
|
}
|
};
|
}
|
catch (Exception ex)
|
{
|
return new WebResponseContent { Status = false, Data = ex.Message };
|
}
|
}
|
|
|
|
|
|
/// <summary>
|
/// 人员监控
|
/// </summary>
|
/// <param name="pageIndex"></param>
|
/// <param name="pageSize"></param>
|
/// <param name="searchKeyword"></param>
|
/// <returns></returns>(这个没有用到了)
|
public WebResponseContent PersonnelMonitoring(PaginationDTO pagination)
|
{
|
try
|
{
|
// 第一步:自动清理过期检修状态
|
var today = DateTime.Today;
|
var recordsToUpdate = Db.Queryable<Dt_Maintenance>()
|
.Where(b => b.MaintenanceDate != null &&
|
b.MaintenanceDate.Value.Date < today )
|
.ToList();
|
|
if (recordsToUpdate.Count > 0)
|
{
|
foreach (var record in recordsToUpdate)//更新
|
{
|
record.MaintenanceDate = null;//清空检修日期
|
record.MaintenancStartTime = null;//清空开始时间
|
record.MaintenancEendTime = null;//清空结束时间
|
record.MaintenanceStatus = 0; // Set to false
|
record.IsPossible = "NULL"; //更改状态为false不运行检修//默认为NULL
|
}
|
Db.Updateable(recordsToUpdate).ExecuteCommand();
|
}
|
|
int totalCount = 0;
|
var sys = _user.Db.Queryable<Sys_User>();
|
var main = Db.Queryable<Dt_Maintenance>();
|
|
var query = sys.InnerJoin<Dt_Maintenance>((a, b) => a.UserName == b.UserAccount)
|
.Where((a, b) => b.IsPossible == "true"); // 展示运行检修的
|
|
// 搜索关键字
|
if (!string.IsNullOrEmpty(pagination.searchKeyword))
|
{
|
query = query.Where((a, b) =>
|
a.UserTrueName.Contains(pagination.searchKeyword) ||
|
a.Userteam.Contains(pagination.searchKeyword));
|
}
|
|
// 状态参数
|
if (pagination.status.HasValue)
|
{
|
query = query.Where((a, b) => b.MaintenanceStatus == pagination.status.Value);
|
}
|
|
// 如果不是管理员,请按部门过滤
|
if (pagination.account != "admin")
|
{
|
var currentUser = _user.Db.Queryable<Sys_User>()
|
.Where(u => u.UserName == pagination.account)
|
.First();
|
|
if (currentUser == null)
|
{
|
return new WebResponseContent { Status = false, Data = "未获取到用户信息" };
|
}
|
|
int? deptId = currentUser.Dept_Id;
|
query = query.Where((a, b) => a.Dept_Id == deptId);
|
}
|
|
var result = query
|
.Select((a, b) => new
|
{
|
a.UserTrueName,
|
a.Userteam,
|
a.HeadImageUrl,
|
b.MaintenanceStatus,
|
b.MaintenanceDate,
|
b.IsPossible,
|
})
|
.ToPageList(pagination.pageIndex, pagination.pageSize, ref totalCount);
|
|
return new WebResponseContent
|
{
|
Status = true,
|
Data = new
|
{
|
TotalCount = totalCount,
|
PageIndex = pagination.pageIndex,
|
PageSize = pagination.pageSize,
|
Items = result
|
}
|
};
|
}
|
catch (Exception ex)
|
{
|
return new WebResponseContent { Status = false, Data = ex.Message };
|
}
|
}
|
|
|
|
|
|
/// <summary>
|
/// 更新状态是否允许进入检修(添加了检修记录)
|
/// </summary>
|
/// <param name="id"></param>
|
/// <param name="ispossible"></param>
|
/// <returns></returns>
|
public WebResponseContent RunOperation(int id, string ispossible)
|
{
|
try
|
{
|
var mon = BaseDal.QueryFirst(x => x.ID == id);
|
if (mon == null)
|
{
|
return new WebResponseContent { Status = false, Message = "无法更改,没有找到该用户" };
|
}
|
var sysuer = _user.QueryData(x => x.UserName == mon.UserAccount).FirstOrDefault();
|
if (ispossible == "true")
|
{
|
mon.IsPossible = "true";
|
mon.MaintenanceDate = DateTime.Now;
|
BaseDal.UpdateData(mon);
|
var recording = new Dt_MaintenanceTeam //添加记录
|
{
|
OperatorName = sysuer.UserTrueName,
|
TeamName = sysuer.RoleName,
|
DistributionTime = DateTime.Now,
|
Creater = "admin",
|
CreateDate = DateTime.Now,
|
|
};
|
_team.AddData(recording);
|
}
|
else
|
{
|
mon.IsPossible = "false";
|
BaseDal.UpdateData(mon);
|
}
|
return new WebResponseContent { Status = true, Data = mon };
|
}
|
catch (Exception ex)
|
{
|
|
return new WebResponseContent { Status = false, Message = "失败:" + ex };
|
}
|
}
|
|
|
/// <summary>
|
/// 更改状态(暂时没有用到)
|
/// </summary>
|
/// <param name="id"></param>
|
/// <returns></returns>
|
public WebResponseContent ChangeTasState(int id)
|
{
|
try
|
{
|
var change = BaseDal.QueryFirst(x => x.ID == id);
|
//将数据库中的int 值转为 枚举型
|
if (!Enum.IsDefined(typeof(Maint), change.MaintenanceStatus))
|
{
|
return new WebResponseContent { Status = false, Message = "当前状态不合法,无法更新" };
|
}
|
|
Maint Status = (Maint)change.MaintenanceStatus; //int ->枚举
|
|
switch (Status)
|
{
|
case Maint.待开始:
|
change.MaintenanceStatus = (int)Maint.检修中;
|
change.MaintenancStartTime = DateTime.Now;
|
break;
|
case Maint.检修中:
|
change.MaintenanceStatus = (int)Maint.已完成;
|
break;
|
case Maint.已完成:
|
change.MaintenancEendTime = DateTime.Now;
|
return new WebResponseContent { Status = false, Message = "当前任务已完成" };
|
default:
|
return new WebResponseContent { Status = false, Message = "更新失败" };
|
}
|
return new WebResponseContent { Status = true, Data = change };
|
}
|
catch (Exception ex)
|
{
|
|
return new WebResponseContent { Status = false, Message = "错误:" + ex };
|
}
|
|
|
}
|
|
/// <summary>
|
/// 检修操作记录
|
/// </summary>
|
/// <param name="pageIndex">页数</param>
|
/// <param name="pageSize">一页多少个数据</param>
|
/// <returns></returns>
|
public WebResponseContent MaintenanceOperationRecord(PaginationDTO pagination)
|
{
|
try
|
{
|
int totalCount = 0;
|
var sys = _user.Db.Queryable<Sys_User>();
|
var main = Db.Queryable<Dt_Maintenance>();
|
|
//模糊查询
|
var query = sys.InnerJoin<Dt_Maintenance>((a, b) => a.UserName == b.UserAccount);
|
if (!string.IsNullOrEmpty(pagination.searchKeyword))
|
{
|
query = query.Where((a, b) =>
|
a.UserTrueName.Contains(pagination.searchKeyword)||
|
a.Userteam.Contains(pagination.searchKeyword)||
|
a.HeadImageUrl.Contains(pagination.searchKeyword)
|
);
|
}
|
//时间查询
|
if (pagination.startDate.HasValue && pagination.endDate.HasValue)
|
{
|
query = query.Where((a, b) => b.MaintenancStartTime >= pagination.startDate.Value && b.MaintenancStartTime <= pagination.endDate.Value);
|
}
|
//排序
|
if (!string.IsNullOrEmpty(pagination.sortField))
|
{
|
var isAcs = pagination.sortOrder?.ToLower() == "asc";
|
query = pagination.sortField.ToLower() switch
|
{
|
|
|
"maintenancstarttime" => isAcs ? query.OrderBy((a, b) => b.MaintenancStartTime) : query.OrderByDescending((a, b) => b.MaintenancStartTime),
|
|
"maintenancenendtime" => isAcs ? query.OrderBy((a, b) => b.MaintenancEendTime) : query.OrderByDescending((a, b) => b.MaintenancEendTime),
|
|
_ => query.OrderByDescending((a, b) => b.Creater) // 默认按创建时间降序
|
};
|
|
}
|
else
|
{
|
query=query.OrderByDescending((a, b) => b.Creater);
|
}
|
|
|
//返回结果
|
var result = query.Select((a, b) => new
|
{
|
a.UserTrueName,
|
a.Userteam,
|
a.HeadImageUrl,
|
a.Dept_Id,
|
b.MaintenancStartTime,
|
b.MaintenancEendTime,
|
}).ToPageList(pagination.pageIndex, pagination.pageSize, ref totalCount);
|
|
return new WebResponseContent
|
{
|
Status = true,
|
Data = new
|
{
|
TotalCount = totalCount,//总数
|
PageIndex = pagination.pageIndex,//页数
|
PageSize = pagination.pageSize,//一页多少个数据
|
Items = result
|
}
|
};
|
}
|
catch (Exception ex)
|
{
|
|
return new WebResponseContent { Status = false, Message = "错误信息:" + ex.Message };
|
}
|
}
|
|
|
/// <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="id"></param>
|
/// <returns></returns>
|
//public WebResponseContent MaintenanceTasksOfTheDay(string account)
|
//{
|
// try
|
// {
|
|
// var query = _user.Db.Queryable<Sys_User>()
|
// .InnerJoin<Dt_Maintenance>((a, b) => a.UserName == b.UserAccount)
|
// .Where((a,b) => b.UserAccount == account ).Select((a, b) => new
|
// {
|
// b.ID,
|
// a.UserTrueName,
|
// a.UserName,
|
// a.CardNumber,
|
// a.Userteam,
|
// a.HeadImageUrl,
|
// b.IsPossible,
|
// b.MaintenanceStatus,
|
// 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>
|
///// <param name="LocalIP">那台电脑登入的ip地址</param>
|
///// <returns></returns>
|
//public WebResponseContent StartMaintenceTask(string account,string LocalIP)
|
//{
|
// try
|
// {
|
// var user = BaseDal.QueryData();
|
// var maint = user.Where(x =>x.UserAccount == account).FirstOrDefault();
|
// var sysuer = _user.QueryData(x => x.UserName == account).FirstOrDefault();//用户表
|
// if (maint == null || sysuer == null)
|
// {
|
// return new WebResponseContent { Status = false, Message = "没有找到该用户" };
|
// }
|
// if (maint.IsLeader!=1)//如果该用户不是班长,那么要等班长先做,他才可以做
|
// {
|
// bool leaderStarted = user.Any(x =>x.Roleid == maint.Roleid &&x.IsLeader == 1 &&x.MaintenanceStatus == 1); //没找到肯定是false
|
// if (!leaderStarted)
|
// {
|
// return new WebResponseContent { Status = false, Message = "请等待组长开始检修" };
|
// }
|
|
// }
|
// //如果满足下面的条件就开始
|
// maint.MaintenancStartTime = DateTime.Now;//记录开始时间
|
// maint.MaintenanceStatus = 1;//更改状态
|
// BaseDal.UpdateData(maint);
|
// //插入记录表
|
// var recording = new Dt_MaintenanceTeam //添加记录
|
// {
|
// OperatorName = sysuer.UserTrueName,
|
// TeamName = sysuer.RoleName,
|
// DistributionTime = DateTime.Now,
|
// IPAddress= LocalIP,
|
// //Creater = "admin",
|
// //CreateDate = DateTime.Now,
|
// };
|
// _team.AddData(recording);
|
|
// return new WebResponseContent { Status = true, Data = maint,Message="开始检修" };
|
// }
|
// catch (Exception ex)
|
// {
|
// return new WebResponseContent { Status = false, Message = "错误信息:" + ex.Message };
|
// }
|
//}
|
|
|
///// <summary>
|
///// 结束检修
|
///// </summary>MaintenanceStatus 0代表检修完成 1代表检修中
|
///// <param name="account"></param>
|
///// <returns></returns>
|
//public WebResponseContent StopMaintenanceTask(string account)
|
//{
|
// try
|
// {
|
// var user = BaseDal.QueryData();//检修表
|
// var maint = user.Where(x => x.UserAccount == account).FirstOrDefault();
|
// var sysuer = _user.QueryData(x => x.UserName == account).FirstOrDefault();//用户表
|
// if (maint == null || sysuer == null)
|
// {
|
// return new WebResponseContent { Status = false, Message = "没有找到该用户" };
|
// }
|
// if (maint.IsLeader == 1)//如果该用户是班长,那么要等全部人都检修完成,他才可以结束检修
|
// {
|
// //先查找所有用户的组是那个组的,组员状态有一个不是1
|
// // 查找同组未完成的组员(IsLeader=0 && MaintenanceStatus=1)
|
// bool hasUnfinishedMembers = user.Any(x =>x.Roleid == maint.Roleid && x.IsLeader == 0 &&
|
// x.MaintenanceStatus == 1); //:Any()有一个满足就返回true表示存在满足条件的记录
|
// if (hasUnfinishedMembers)
|
// {
|
// return new WebResponseContent { Status = false, Message = "还有组员未完成当前批次检修" };
|
// }
|
// }
|
// //如果满足下面的条件就开始
|
// maint.MaintenancEendTime = DateTime.Now;//记录结束时间
|
// maint.MaintenanceStatus = 0;//更改状态
|
// BaseDal.UpdateData(maint);
|
// ////插入记录表
|
// //var recording = new Dt_MaintenanceTeam //添加记录
|
// //{
|
// // OperatorName = sysuer.UserTrueName,
|
// // TeamName = sysuer.RoleName,
|
// // DistributionTime = DateTime.Now,
|
// // EndTime=DateTime.Now,
|
// //};
|
// //_team.AddData(recording);
|
|
// return new WebResponseContent { Status = true, Data = maint, Message = "完成检修" };
|
// }
|
// catch (Exception ex)
|
// {
|
// return new WebResponseContent { Status = false, Message = "错误信息:" + ex.Message };
|
// }
|
//}
|
|
|
/// <summary>
|
/// 开始检修
|
/// </summary>
|
/// <param name="account">账号</param>
|
/// <param name="LocalIP">那台电脑登入的ip地址</param>
|
/// <returns></returns>
|
public WebResponseContent StartMaintenceTask(string account, string LocalIP)
|
{
|
try
|
{
|
var user = BaseDal.QueryData();//检修表
|
var maint = user.Where(x => x.UserAccount == account).FirstOrDefault(); //在检修表中先找到该用户
|
var sysuer = _user.QueryData(x => x.UserName == account).FirstOrDefault();//在用户表中找到用户
|
if (maint == null || sysuer == null)
|
{
|
return new WebResponseContent { Status = false, Message = "没有找到该用户" };
|
}
|
// 查找该用户在 _team 表中的最新一条记录
|
var lastRecord = _team.QueryData(x => x.Account == account)
|
.OrderByDescending(x => x.CreateDate)
|
.FirstOrDefault();
|
|
if (lastRecord != null && lastRecord.MaintenanceStatus == 1)
|
{
|
return new WebResponseContent { Status = false, Message = "你已经在开始检修了,请不要重复点击" };
|
}
|
|
//先要找到该用户属于那个角色的,这个角色中属于那个什么类型(组长/组员)
|
if (maint.IsLeader != 1)//如果该用户不是班长,那么要等班长先做,他才可以做
|
{
|
bool leaderStarted = user.Any(x => x.IsLeader == 1 && x.MaintenanceStatus == 1); //否有满足条件 找到一条就返回true MaintenanceStatus(0没有开始,1开始)
|
if (!leaderStarted)
|
{
|
return new WebResponseContent { Status = false, Message = "请等待组长开始检修" };
|
}
|
|
}
|
if (true)
|
{
|
|
}
|
//如果满足下面的条件就开始
|
maint.MaintenancStartTime = DateTime.Now;//记录开始时间
|
maint.MaintenanceStatus = 1;//更改状态
|
BaseDal.UpdateData(maint);
|
//插入记录表
|
var recording = new Dt_MaintenanceTeam //添加记录
|
{
|
Account = account,
|
MaintenanceStatus=1,
|
OperatorName = sysuer.UserTrueName,
|
TeamName = sysuer.RoleName,
|
DistributionTime = DateTime.Now,
|
IPAddress = LocalIP,
|
};
|
_team.AddData(recording);
|
|
return new WebResponseContent { Status = true, Data = maint, Message = "开始检修" };
|
}
|
catch (Exception ex)
|
{
|
return new WebResponseContent { Status = false, Message = "错误信息:" + ex.Message };
|
}
|
}
|
|
|
/// <summary>
|
/// 结束检修
|
/// </summary>MaintenanceStatus 0代表检修完成 1代表检修中
|
/// <param name="account"></param>
|
/// <returns></returns>
|
public WebResponseContent StopMaintenanceTask(string account)
|
{
|
try
|
{
|
var user = BaseDal.QueryData();//检修表
|
var maint = user.Where(x => x.UserAccount == account).FirstOrDefault();
|
var sysuer = _user.QueryData(x => x.UserName == account).FirstOrDefault();//用户表
|
if (maint == null || sysuer == null)
|
{
|
return new WebResponseContent { Status = false, Message = "没有找到该用户" };
|
}
|
|
// 查找该用户在 _team 表中的最新一条记录
|
var lastRecord = _team.QueryData(x => x.Account == account)
|
.OrderByDescending(x => x.CreateDate)
|
.FirstOrDefault();
|
|
if (lastRecord == null || lastRecord.MaintenanceStatus != 1)
|
{
|
return new WebResponseContent { Status = false, Message = "你还没有开始检修,请先点击开始检修" };
|
}
|
|
if (maint.IsLeader == 1)//如果该用户是班长,那么要等全部人都检修完成,他才可以结束检修
|
{
|
//先查找所有用户的组是那个组的,组员状态有一个不是1
|
// 查找同组未完成的组员(IsLeader=0 && MaintenanceStatus=1)
|
var hasUnfinishedMembers = user.Where(x =>x.IsLeader == 0 &&x.MaintenanceStatus == 1).ToList(); //:Any()有一个满足就返回true表示存在满足条件的记录
|
if (hasUnfinishedMembers.Count>0)
|
{
|
return new WebResponseContent { Status = false, Message = "还有组员未完成当前批次检修" };
|
}
|
}
|
//如果满足下面的条件就开始
|
maint.MaintenancEendTime = DateTime.Now;//记录结束时间
|
maint.MaintenanceStatus = 0;//更改状态
|
BaseDal.UpdateData(maint);
|
////插入记录表
|
var recording = new Dt_MaintenanceTeam //添加记录
|
{
|
Account = account,
|
MaintenanceStatus=0,
|
OperatorName = sysuer.UserTrueName,
|
TeamName = sysuer.RoleName,
|
EndTime = DateTime.Now,
|
};
|
_team.AddData(recording);
|
|
return new WebResponseContent { Status = true, Data = maint, Message = "完成检修" };
|
}
|
catch (Exception ex)
|
{
|
return new WebResponseContent { Status = false, Message = "错误信息:" + ex.Message };
|
}
|
}
|
|
|
/// <summary>
|
/// 展示开始检修人员
|
/// </summary>
|
/// <returns></returns>
|
public WebResponseContent YShowStartTake()
|
{
|
try
|
{
|
var reslut=BaseDal.QueryData(x => x.MaintenanceStatus == 1).ToList();
|
if (reslut.Count<=0)
|
{
|
return new WebResponseContent { Status = false, Message = "还没有人开始检修" };
|
}
|
return new WebResponseContent { Status = true, Data = reslut,Message="检修人员有以下" };
|
}
|
catch (Exception ex)
|
{
|
|
return new WebResponseContent { Status = false, Message = ex.Message };
|
}
|
}
|
|
/// <summary>
|
/// 状态枚举
|
/// </summary>
|
private enum Maint
|
{
|
//待检修=0,
|
待开始=0,
|
检修中=1,
|
已完成=2
|
|
}
|
|
}
|
}
|