105040 Update 增加表结构
This commit is contained in:
parent
7c26e343a6
commit
adfc11b82d
|
@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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<LectotypeLine> SelectedLines { get; set; }
|
||||
}
|
||||
|
||||
}
|
|
@ -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<LectotypeLine> SubLines { get; set; }
|
||||
}
|
||||
|
||||
}
|
|
@ -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<LectotypeLine> CableLectotypeLines { get; set; }
|
||||
}
|
||||
|
||||
}
|
|
@ -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<MotorDataModel>("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<MotorDataModel>(motorData).ExecuteCommand();
|
||||
return result != 0;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -42,8 +42,10 @@
|
|||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="DBHelper.cs" />
|
||||
<Compile Include="Model\CableLectotype.cs" />
|
||||
<Compile Include="Model\LectotypeLine.cs" />
|
||||
<Compile Include="Model\MotorDataModel.cs" />
|
||||
<Compile Include="MotorLectotypeService.cs" />
|
||||
<Compile Include="Model\MotorModel.cs" />
|
||||
<Compile Include="PluginServices.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
|
|
Loading…
Reference in New Issue