xulisong 6 лет назад
Родитель
Сommit
536755570d

+ 77 - 0
MBI/SAGA.MBIAssistData/BLL/SystemCheckReportBll.cs

@@ -0,0 +1,77 @@
+/*-------------------------------------------------------------------------
+ * 功能描述:SystemCheckReportBll
+ * 作者:xulisong
+ * 创建时间: 2019/3/1 8:45:00
+ * 版本号:v1.0
+ *  -------------------------------------------------------------------------*/
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Saga.Framework.DB;
+using SAGA.DotNetUtils.Data;
+using SAGA.DotNetUtils.Utilities;
+using SAGA.MBIAssistData.Model;
+
+namespace SAGA.MBIAssistData
+{
+    public class SystemCheckReportBll:Bll<SystemCheckReport>
+    {
+        public SystemCheckReportBll()
+        {
+            Init(this.GetType().FullName, this.GetType().Assembly.FullName);
+        }
+
+        public bool ExistReport(string floorId, string gplotType)
+        {
+            this.CheckDAL();
+            string condion = string.Format("FloorId='{0}' And GplotType='{1}'", floorId, gplotType);
+            return this.m_BaseDal.ExistByCondition(condion);
+        }
+
+        public SystemCheckReport GetCurrentReport(string floorId, string gplotType)
+        {
+            this.CheckDAL();
+            string condion = string.Format("FloorId='{0}' And GplotType='{1}'", floorId, gplotType);
+            string orderBy = string.Format("BuildingTime Desc ");
+            return this.m_BaseDal.FindSingle(condion,orderBy);
+        }
+
+        /// <summary>
+        /// 创建报表
+        /// </summary>
+        /// <param name="report"></param>
+        /// <param name="results"></param>
+        /// <returns></returns>
+        public bool CreateReport(SystemCheckReport report, List<SystemCheckResult> results)
+        {
+            this.CheckDAL();
+            var reportId = GuidUtil.GetNString();
+            report.Id = reportId;
+          
+            using (var trans = CreateDatabase().CreateTransaction())
+            {
+
+                try
+                {
+                    Insert(report, trans);
+                    foreach (var systemCheckResult in results)
+                    {
+                        systemCheckResult.Id = GuidUtil.GetNString();
+                        systemCheckResult.ReportId = reportId;
+                        SingleFactory<SystemCheckResultBll>.Instance.Insert(systemCheckResult, trans);
+                    }                
+                    trans.Commit();
+                }
+                catch (Exception)
+                {
+                    trans.Rollback();
+                    throw;
+                }
+            }
+            return true;
+        }
+    }
+}

+ 48 - 0
MBI/SAGA.MBIAssistData/BLL/SystemCheckResultBll.cs

@@ -0,0 +1,48 @@
+/*-------------------------------------------------------------------------
+ * 功能描述:SystemCheckResultBll
+ * 作者:xulisong
+ * 创建时间: 2019/3/1 8:45:17
+ * 版本号:v1.0
+ *  -------------------------------------------------------------------------*/
+
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Saga.Framework.DB;
+using SAGA.MBIAssistData.Model;
+
+namespace SAGA.MBIAssistData
+{
+    public class SystemCheckResultBll : Bll<SystemCheckResult>
+    {
+        public SystemCheckResultBll()
+        {
+            Init(this.GetType().FullName, this.GetType().Assembly.FullName);
+        }
+
+        public List<SystemCheckResult> FindResults(string reportId)
+        {
+            this.CheckDAL();
+            string condion = string.Format("ReportId='{0}'", reportId);
+            return Find(condion);
+        }
+
+        public bool UpdateMisinformationFlag(bool misinformationFlag, string key)
+        {
+            this.CheckDAL();
+            Hashtable hastable = new Hashtable();
+            hastable.Add("IsMisinformation", misinformationFlag);
+            return Update(hastable, key);
+        }
+
+        public bool UpdateCorrectedFlag(bool correctedFlag, string key)
+        {
+            Hashtable hastable = new Hashtable();
+            hastable.Add("IsCorrected", correctedFlag);
+            return Update(hastable, key);
+        }
+    }
+}

+ 36 - 0
MBI/SAGA.MBIAssistData/DAL/SystemCheckReportDal.cs

@@ -0,0 +1,36 @@
+/*-------------------------------------------------------------------------
+ * 功能描述:SystemCheckReportDal
+ * 作者:xulisong
+ * 创建时间: 2019/3/1 8:45:29
+ * 版本号:v1.0
+ *  -------------------------------------------------------------------------*/
+
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Data;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Saga.Framework.DB.Sqlite;
+using SAGA.MBIAssistData.Model;
+
+namespace SAGA.MBIAssistData
+{
+    public class SystemCheckReportDal : SqliteDal<SystemCheckReport>
+    {
+        public SystemCheckReportDal()
+        {
+            TableName = "SystemCheckReport";
+            PrimaryKey = "Id";
+        }
+        protected override Hashtable EntityToRecord(SystemCheckReport obj)
+        {
+            return base.EntityToRecord(obj);
+        }
+        protected override SystemCheckReport ReaderToEntity(IDataReader dr)
+        {
+            return base.ReaderToEntity(dr);
+        }
+    }
+}

+ 36 - 0
MBI/SAGA.MBIAssistData/DAL/SystemCheckResultDal.cs

@@ -0,0 +1,36 @@
+/*-------------------------------------------------------------------------
+ * 功能描述:SystemCheckResultDal
+ * 作者:xulisong
+ * 创建时间: 2019/3/1 8:45:51
+ * 版本号:v1.0
+ *  -------------------------------------------------------------------------*/
+
+using Saga.Framework.DB.Sqlite;
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Data;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using SAGA.MBIAssistData.Model;
+
+namespace SAGA.MBIAssistData
+{
+    public class SystemCheckResultDal:SqliteDal<SystemCheckResult>
+    {
+        public SystemCheckResultDal()
+        {
+            TableName = "SystemCheckResult";
+            PrimaryKey = "Id";
+        }
+        protected override Hashtable EntityToRecord(SystemCheckResult obj)
+        {
+            return base.EntityToRecord(obj);
+        }
+        protected override SystemCheckResult ReaderToEntity(IDataReader dr)
+        {
+            return base.ReaderToEntity(dr);
+        }
+    }
+}

+ 39 - 0
MBI/SAGA.MBIAssistData/Model/SystemCheckReport.cs

@@ -0,0 +1,39 @@
+/*-------------------------------------------------------------------------
+ * 功能描述:SystemCheckReport
+ * 作者:xulisong
+ * 创建时间: 2019/2/28 9:11:33
+ * 版本号:v1.0
+ *  -------------------------------------------------------------------------*/
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SAGA.MBIAssistData.Model
+{
+    /// <summary>
+    /// 检查报表类
+    /// </summary>
+    public class SystemCheckReport
+    {
+        /// <summary>
+        /// 报表Id
+        /// </summary>
+        public string Id { get; set; }
+        /// <summary>
+        /// 关联楼层Id
+        /// </summary>
+        public string FloorId { get; set; }
+
+        /// <summary>
+        /// 关联拓扑Id
+        /// </summary>
+        public string GplotType { get; set; }
+        /// <summary>
+        /// 创建时间
+        /// </summary>
+        public string BuildingTime { get; set; }
+    }
+}

+ 59 - 0
MBI/SAGA.MBIAssistData/Model/SystemCheckResult.cs

@@ -0,0 +1,59 @@
+/*-------------------------------------------------------------------------
+ * 功能描述:SystemCheckResult
+ * 作者:xulisong
+ * 创建时间: 2019/2/28 9:11:51
+ * 版本号:v1.0
+ *  -------------------------------------------------------------------------*/
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SAGA.MBIAssistData.Model
+{
+    /// <summary>
+    /// 检查结果类
+    /// </summary>
+    public class SystemCheckResult
+    {
+        /// <summary>
+        /// 结果Id
+        /// </summary>
+        public string Id { get; set; }
+
+        /// <summary>
+        /// 报表Id
+        /// </summary>
+        public string ReportId { get; set; }
+
+        /// <summary>
+        /// 系统类型
+        /// </summary>
+        public string SystemName { get; set; }
+        /// <summary>
+        /// BimId
+        /// </summary>
+        public string BimId { get; set; }
+
+        /// <summary>
+        /// 流向
+        /// </summary>
+        public string FlowDirection { get; set; }
+
+        /// <summary>
+        /// 错误编码
+        /// </summary>
+        public string ErrorCode { get; set; }
+
+        /// <summary>
+        /// 是否已改正
+        /// </summary>
+        public bool IsCorrected { get; set; }
+        /// <summary>
+        /// 是否误报
+        /// </summary>
+        public bool IsMisinformation { get; set; }
+    }
+}