From adfc11b82df37f254c83a3a97be55bee2fc28bf0 Mon Sep 17 00:00:00 2001 From: lihanbo Date: Mon, 23 Dec 2024 11:56:17 +0800 Subject: [PATCH] =?UTF-8?q?105040=20Update=20=E5=A2=9E=E5=8A=A0=E8=A1=A8?= =?UTF-8?q?=E7=BB=93=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Sinvo.EplanHpD.Plugin.Service/DBHelper.cs | 12 +++- .../Model/CableLectotype.cs | 44 +++++++++++++ .../Model/LectotypeLine.cs | 63 +++++++++++++++++++ .../Model/MotorModel.cs | 35 +++++++++++ .../MotorLectotypeService.cs | 34 ---------- .../Sinvo.EplanHpD.Plugin.Service.csproj | 4 +- 6 files changed, 155 insertions(+), 37 deletions(-) create mode 100644 Sinvo.EplanHpD.Plugin.Service/Model/CableLectotype.cs create mode 100644 Sinvo.EplanHpD.Plugin.Service/Model/LectotypeLine.cs create mode 100644 Sinvo.EplanHpD.Plugin.Service/Model/MotorModel.cs delete mode 100644 Sinvo.EplanHpD.Plugin.Service/MotorLectotypeService.cs diff --git a/Sinvo.EplanHpD.Plugin.Service/DBHelper.cs b/Sinvo.EplanHpD.Plugin.Service/DBHelper.cs index d749221..d76c416 100644 --- a/Sinvo.EplanHpD.Plugin.Service/DBHelper.cs +++ b/Sinvo.EplanHpD.Plugin.Service/DBHelper.cs @@ -12,7 +12,7 @@ namespace Sinvo.EplanHpD.Plugin.Service { private static string _dbUser = "sa"; private static string _dbPassword = "Sa1234"; - private static string _dbServer = "."; + private static string _dbServer = "192.168.91.130"; private static string _dbName = "MotorData"; private static string _connectionString => $"Server={_dbServer};Database={_dbName};User Id={_dbUser};Password={_dbPassword};"; @@ -27,10 +27,18 @@ namespace Sinvo.EplanHpD.Plugin.Service ConnectionString = _connectionString, DbType = DbType.SqlServer, IsAutoCloseConnection = true, - InitKeyType = InitKeyType.Attribute + InitKeyType = InitKeyType.Attribute, + }); return _db; } } + public void CodeFirst() + { + DB.CodeFirst.InitTables(typeof(Model.MotorDataModel)); + DB.CodeFirst.InitTables(typeof(Model.Motor)); + DB.CodeFirst.InitTables(typeof(Model.CableLectotype)); + DB.CodeFirst.InitTables(typeof(Model.LectotypeLine)); + } } } diff --git a/Sinvo.EplanHpD.Plugin.Service/Model/CableLectotype.cs b/Sinvo.EplanHpD.Plugin.Service/Model/CableLectotype.cs new file mode 100644 index 0000000..3106776 --- /dev/null +++ b/Sinvo.EplanHpD.Plugin.Service/Model/CableLectotype.cs @@ -0,0 +1,44 @@ +using SqlSugar; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Sinvo.EplanHpD.Plugin.Service.Model +{ + + [SugarTable("T_CABLE_LECTOTYPES")] + public class CableLectotype + { + [SugarColumn(IsPrimaryKey = true )] + public string CableLectotypeId { get; set; } + + [SugarColumn(IsNullable = true)] + public string MotorId { get; set; } + + [SugarColumn(IsNullable = true)] + public int CableConnectionType { get; set; } + + [SugarColumn(IsNullable = true)] + public string AxisNo { get; set; } + + [SugarColumn(IsNullable = true)] + public string CableType { get; set; } + + [SugarColumn(IsNullable = true)] + public int EncoderLineParagraph { get; set; } + + [SugarColumn(IsNullable = true)] + public int PowerLineParagraph { get; set; } + [SugarColumn(IsNullable = true)] + public string CableModelStr { get; set; } + [SugarColumn(IsNullable = true)] + public bool IsEnableParagraph { get; set; } + + [SugarColumn(IsIgnore = true)] + + public virtual ICollection SelectedLines { get; set; } + } + +} diff --git a/Sinvo.EplanHpD.Plugin.Service/Model/LectotypeLine.cs b/Sinvo.EplanHpD.Plugin.Service/Model/LectotypeLine.cs new file mode 100644 index 0000000..3510fc4 --- /dev/null +++ b/Sinvo.EplanHpD.Plugin.Service/Model/LectotypeLine.cs @@ -0,0 +1,63 @@ +using SqlSugar; +using System.Collections.Generic; + +namespace Sinvo.EplanHpD.Plugin.Service.Model +{ + + [SugarTable("T_LECTOTYPE_LINES")] + public class LectotypeLine + { + [SugarColumn(IsNullable = true)] + public string CableLectotypeId { get; set; } + [SugarColumn(IsPrimaryKey = true)] + public string LectotypeLineId { get; set; } + [SugarColumn(IsNullable = true)] + public string ParentLectotypeLineId { get; set; } + + public string MotorId { get; set; } + + public int SeqNo { get; set; } + [SugarColumn(IsNullable = true)] + public string AxisNo { get; set; } + + [SugarColumn(IsNullable = true)] + public string CableConnectionClass { get; set; } + + [SugarColumn(IsNullable = true)] + public string CableType { get; set; } + + [SugarColumn(IsNullable = true)] + public bool IsFlexibility { get; set; } + + [SugarColumn(IsNullable = true)] + public double PowerLineLength { get; set; } + + [SugarColumn(IsNullable = true)] + public double EncoderLineLength { get; set; } + + [SugarColumn(IsNullable = true)] + public string DrawingNo { get; set; } + + [SugarColumn(IsNullable = true)] + public string CableModelNo { get; set; } + + [SugarColumn(IsNullable = true)] + public int LineCount { get; set; } + + [SugarColumn(IsNullable = true)] + public int CurrentLine { get; set; } + + [SugarColumn(IsNullable = true)] + public bool IsLectotype { get; set; } + + [SugarColumn(IsNullable = true)] + public string CableModel { get; set; } + + [SugarColumn(IsNullable = true)] + public bool IsChecked { get; set; } + + [SugarColumn(IsIgnore = true)] + public virtual ICollection SubLines { get; set; } + } + +} \ No newline at end of file diff --git a/Sinvo.EplanHpD.Plugin.Service/Model/MotorModel.cs b/Sinvo.EplanHpD.Plugin.Service/Model/MotorModel.cs new file mode 100644 index 0000000..6e80ec5 --- /dev/null +++ b/Sinvo.EplanHpD.Plugin.Service/Model/MotorModel.cs @@ -0,0 +1,35 @@ +using SqlSugar; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Sinvo.EplanHpD.Plugin.Service.Model +{ + + [SugarTable("T_MOTOR")] + public class Motor + { + //public string MotorId { get; set; } + [SugarColumn(IsPrimaryKey = true)] + public string OccPartId { get; set; } + + public string MotorPower { get; set; } + + [SugarColumn(IsNullable = true)] + public string Brand { get; set; } + + [SugarColumn(IsNullable = true)] + public string MotorSerie { get; set; } + + public string MotorModelStr { get; set; } + + public string AxisNo { get; set; } + + + [SugarColumn(IsIgnore = true)] + public virtual ICollection CableLectotypeLines { get; set; } + } + +} diff --git a/Sinvo.EplanHpD.Plugin.Service/MotorLectotypeService.cs b/Sinvo.EplanHpD.Plugin.Service/MotorLectotypeService.cs deleted file mode 100644 index 2f4aa15..0000000 --- a/Sinvo.EplanHpD.Plugin.Service/MotorLectotypeService.cs +++ /dev/null @@ -1,34 +0,0 @@ -using Sinvo.EplanHpD.Plugin.Service.Model; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Sinvo.EplanHpD.Plugin.Service -{ - public class MotorLectotypeService - { - public string GetMotorLectotypeData(string motorOccId) - { - var data = DBHelper.DB.Queryable("mt") - .Where(mt => mt.ID == motorOccId) - .First(); - if (data != null) - { - return data.Data; - } - else - { - return ""; - } - } - - public bool SaveMotorLectotypeData(string motorOccId, string data) - { - var motorData = new MotorDataModel { ID = motorOccId, Data = data }; - var result = DBHelper.DB.Storageable(motorData).ExecuteCommand(); - return result != 0; - } - } -} diff --git a/Sinvo.EplanHpD.Plugin.Service/Sinvo.EplanHpD.Plugin.Service.csproj b/Sinvo.EplanHpD.Plugin.Service/Sinvo.EplanHpD.Plugin.Service.csproj index b9954d9..38b2f85 100644 --- a/Sinvo.EplanHpD.Plugin.Service/Sinvo.EplanHpD.Plugin.Service.csproj +++ b/Sinvo.EplanHpD.Plugin.Service/Sinvo.EplanHpD.Plugin.Service.csproj @@ -42,8 +42,10 @@ + + - +