namespace Yw.DAL { /// /// RepairRequestForm /// public interface IRepairRequestForm : IBaseTraceDAL { /// /// 获取最近列表 /// List GetLastList(int Number = 1); /// /// 获取所有待受理的数据 /// List GetPendingList(); /// /// 获取待受理的数量 /// int GetPendingCount(); /// /// 通过 FormStatus 获取 /// List GetByFormStatus(int FormStatus); /// /// 通过 FormStatus 获取数量 /// int GetCountByFormStatus(int FormStatus); /// /// 通过 EquipmentID 获取 /// List GetByEquipmentID(long EquipmentID); /// /// 通过 EquipmentIds 获取 /// List GetByEquipmentIds(List EquipmentIds); /// /// 获取某日的数量 /// int GetCountOfDay(DateTime Day); /// /// 更新 FormStatus /// bool UpdateFormStatus(long ID, int FormStatus); /// /// 插入 /// long Insert(Entity.RepairRequestForm entity, List entity4FileList) { if (string.IsNullOrEmpty(entity.FormNo)) { var count = GetCountOfDay(entity.CreateTime) + 1; entity.FormNo = $"R{entity.CreateTime.ToString("yyyyMMdd")}{count.ToString("000000")}"; } using (var db = new SqlSugarClient(ConnectionConfig)) { try { db.BeginTran(); var formId = db.Insertable(entity).ExecuteReturnSnowflakeId(); if (formId < 1) { db.RollbackTran(); return default; } var entity4Log = new Entity.RepairRequestLog(); entity4Log.FormID = formId; entity4Log.OperateType = (int)eRequestOperation.Create; entity4Log.OperateContent = "创建"; entity4Log.OperateTime = entity.CreateTime; entity4Log.OperateUserID = entity.CreateUserID; entity4Log.OperateUserName = entity.CreateUserName; entity4Log.OperateNote = "创建"; var logId = db.Insertable(entity4Log).ExecuteReturnSnowflakeId(); if (logId < 1) { db.RollbackTran(); return default; } if (entity4FileList != null && entity4FileList.Count > 0) { entity4FileList.ForEach(x => x.FormID = formId); var fileIds = db.Insertable(entity4FileList).ExecuteReturnSnowflakeIdList(); if (fileIds == null || fileIds.Count != entity4FileList.Count) { db.RollbackTran(); return default; } } db.CommitTran(); return formId; } catch { db.RollbackTran(); throw; } } } /// /// 驳回 /// bool Reject(long ID, string Reason); /// /// 受理 /// bool Accept(long ID, string Note); /// /// 获取我的模糊分页列表 /// List GetMyFluzzyPageList ( long CreateUserID, int? FormStatus, int? Urgency, DateTime? StartTime, DateTime? EndTime, int PageIndex, int PageSize, ref int Total ); /// /// 获取模糊分页列表 /// List GetFluzzyPageList ( List EquipmentIds, long? CreateUserID, int? FormStatus, int? Urgency, string FormNo, DateTime? StartTime, DateTime? EndTime, int PageIndex, int PageSize, ref int Total ); /// /// 获取待派单分页列表 /// List> GetJustAccepedPageList ( List EquipmentIds, long? CreateUserID, int? Urgency, string FormNo, DateTime? StartTime, DateTime? EndTime, int PageIndex, int PageSize, ref int Total ); } }