From d7d1c90670322a1a2190225f5d81f5ac70f0b709 Mon Sep 17 00:00:00 2001 From: WenJY Date: Wed, 6 May 2026 16:31:56 +0800 Subject: [PATCH] =?UTF-8?q?change=20-=20ORM=20=E5=8A=9F=E8=83=BD=E5=AE=9E?= =?UTF-8?q?=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Sln.Wcs.Model/Domain/BaseDeviceHost.cs | 130 +++++++++++++++ Sln.Wcs.Model/Domain/BaseDeviceInfo.cs | 8 + Sln.Wcs.Model/Domain/BaseDeviceParam.cs | 148 ++++++++++++++++++ Sln.Wcs.Model/Domain/BaseLocationInfo.cs | 8 - .../service/IBaseDeviceHostService.cs | 34 ++++ .../service/IBaseDeviceParamService.cs | 34 ++++ .../service/Impl/BaseDeviceHostServiceImpl.cs | 36 +++++ .../Impl/BaseDeviceParamServiceImpl.cs | 36 +++++ Sln.Wcs/ORMUnitTest.cs | 51 ++++++ Sln.Wcs/Program.cs | 1 - 10 files changed, 477 insertions(+), 9 deletions(-) create mode 100644 Sln.Wcs.Model/Domain/BaseDeviceHost.cs create mode 100644 Sln.Wcs.Model/Domain/BaseDeviceParam.cs create mode 100644 Sln.Wcs.Repository/service/IBaseDeviceHostService.cs create mode 100644 Sln.Wcs.Repository/service/IBaseDeviceParamService.cs create mode 100644 Sln.Wcs.Repository/service/Impl/BaseDeviceHostServiceImpl.cs create mode 100644 Sln.Wcs.Repository/service/Impl/BaseDeviceParamServiceImpl.cs create mode 100644 Sln.Wcs/ORMUnitTest.cs diff --git a/Sln.Wcs.Model/Domain/BaseDeviceHost.cs b/Sln.Wcs.Model/Domain/BaseDeviceHost.cs new file mode 100644 index 0000000..78b59b5 --- /dev/null +++ b/Sln.Wcs.Model/Domain/BaseDeviceHost.cs @@ -0,0 +1,130 @@ +#region << 版 本 注 释 >> + +/*-------------------------------------------------------------------- +* 版权所有 (c) 2026 WenJY 保留所有权利。 +* CLR版本:4.0.30319.42000 +* 机器名称:Mr.Wen's MacBook Pro +* 命名空间:Sln.Wcs.Model.Domain +* 唯一标识:0FFADD08-D638-473B-81B8-0702454AFAD3 +* +* 创建者:WenJY +* 电子邮箱: +* 创建时间:2026-05-06 16:10:03 +* 版本:V1.0.0 +* 描述: +* +*-------------------------------------------------------------------- +* 修改人: +* 时间: +* 修改说明: +* +* 版本:V1.0.0 +*--------------------------------------------------------------------*/ + +#endregion << 版 本 注 释 >> + +using SqlSugar; + +namespace Sln.Wcs.Model.Domain; +/// +///设备主机 +/// +[SugarTable("base_device_host"), TenantAttribute("core")] +public class BaseDeviceHost +{ + /// + /// Desc:主键标识 + /// Default: + /// Nullable:False + /// + [SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnName = "obj_id")] + public int objId { get; set; } + + /// + /// Desc:主机编号 + /// Default: + /// Nullable:False + /// + [SugarColumn(ColumnName = "host_code")] + public string hostCode { get; set; } + + /// + /// Desc:主机名称 + /// Default: + /// Nullable:False + /// + [SugarColumn(ColumnName = "host_name")] + public string hostName { get; set; } + + /// + /// Desc:主机IP + /// Default: + /// Nullable:False + /// + [SugarColumn(ColumnName = "host_ip")] + public string hostIP { get; set; } + + /// + /// Desc:主机端口 + /// Default: + /// Nullable:False + /// + [SugarColumn(ColumnName = "host_port")] + public int hostPort { get; set; } + + /// + /// Desc:主机路径 + /// Default: + /// Nullable:False + /// + [SugarColumn(ColumnName = "host_path")] + public string hostPath { get; set; } + + /// + /// Desc:是否标识:1-是;0-否 + /// Default:0 + /// Nullable:True + /// + [SugarColumn(ColumnName = "is_flag")] + public int? isFlag { get; set; } + + /// + /// Desc:备注 + /// Default: + /// Nullable:True + /// + [SugarColumn(ColumnName = "remark")] + public string remark { get; set; } + + /// + /// Desc:创建人 + /// Default: + /// Nullable:True + /// + [SugarColumn(ColumnName = "created_by")] + public string createdBy { get; set; } + + /// + /// Desc:创建时间 + /// Default: + /// Nullable:True + /// + [SugarColumn(ColumnName = "created_time")] + public DateTime? createdTime { get; set; } + + /// + /// Desc:更新人 + /// Default: + /// Nullable:True + /// + [SugarColumn(ColumnName = "updated_by")] + public string updatedBy { get; set; } + + /// + /// Desc:更新时间 + /// Default: + /// Nullable:True + /// + [SugarColumn(ColumnName = "updated_time")] + public DateTime? updatedTime { get; set; } +} \ No newline at end of file diff --git a/Sln.Wcs.Model/Domain/BaseDeviceInfo.cs b/Sln.Wcs.Model/Domain/BaseDeviceInfo.cs index 04fd088..8214a8c 100644 --- a/Sln.Wcs.Model/Domain/BaseDeviceInfo.cs +++ b/Sln.Wcs.Model/Domain/BaseDeviceInfo.cs @@ -58,6 +58,14 @@ namespace Sln.Wcs.Model.Domain /// [SugarColumn(ColumnName = "device_name")] public string deviceName { get; set; } + + /// + /// Desc:主机编号 + /// Default: + /// Nullable:False + /// + [SugarColumn(ColumnName = "host_code")] + public string hostCode { get; set; } /// /// Desc:设备类型:0-输送线;1-AGV;2-提升机 diff --git a/Sln.Wcs.Model/Domain/BaseDeviceParam.cs b/Sln.Wcs.Model/Domain/BaseDeviceParam.cs new file mode 100644 index 0000000..36cc4c6 --- /dev/null +++ b/Sln.Wcs.Model/Domain/BaseDeviceParam.cs @@ -0,0 +1,148 @@ +#region << 版 本 注 释 >> + +/*-------------------------------------------------------------------- +* 版权所有 (c) 2026 WenJY 保留所有权利。 +* CLR版本:4.0.30319.42000 +* 机器名称:Mr.Wen's MacBook Pro +* 命名空间:Sln.Wcs.Model.Domain +* 唯一标识:30946586-7D2E-450D-A76D-FF0396AF38B1 +* +* 创建者:WenJY +* 电子邮箱: +* 创建时间:2026-05-06 16:19:47 +* 版本:V1.0.0 +* 描述: +* +*-------------------------------------------------------------------- +* 修改人: +* 时间: +* 修改说明: +* +* 版本:V1.0.0 +*--------------------------------------------------------------------*/ + +#endregion << 版 本 注 释 >> + +using SqlSugar; + +namespace Sln.Wcs.Model.Domain; +/// +///设备信息 +/// +[SugarTable("base_device_param"), TenantAttribute("core")] +public class BaseDeviceParam +{ + /// + /// Desc:主键标识 + /// Default: + /// Nullable:False + /// + [SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnName = "obj_id")] + public int objId { get; set; } + + /// + /// Desc:参数编号 + /// Default: + /// Nullable:False + /// + [SugarColumn(ColumnName = "param_code")] + public string paramCode { get; set; } + + /// + /// Desc:设备编号 + /// Default: + /// Nullable:False + /// + [SugarColumn(ColumnName = "device_code")] + public string deviceCode { get; set; } + + /// + /// Desc:参数名称 + /// Default: + /// Nullable:False + /// + [SugarColumn(ColumnName = "param_name")] + public string paramName { get; set; } + + /// + /// Desc:参数地址 + /// Default: + /// Nullable:False + /// + [SugarColumn(ColumnName = "param_address")] + public string paramAddress { get; set; } + + /// + /// Desc:参数类型 + /// Default: + /// Nullable:False + /// + [SugarColumn(ColumnName = "param_type")] + public string paramType { get; set; } + + /// + /// Desc:操作类型:1-只读;2-只写;0-默认读写 + /// Default: + /// Nullable:False + /// + [SugarColumn(ColumnName = "operation_type")] + public string operationType { get; set; } + + /// + /// Desc:操作频率(毫秒) + /// Default: + /// Nullable:False + /// + [SugarColumn(ColumnName = "operation_frequency")] + public string operationFrequency { get; set; } + + /// + /// Desc:是否标识:1-是;0-否 + /// Default:0 + /// Nullable:True + /// + [SugarColumn(ColumnName = "is_flag")] + public int? isFlag { get; set; } + + /// + /// Desc:备注 + /// Default: + /// Nullable:True + /// + [SugarColumn(ColumnName = "remark")] + public string remark { get; set; } + + /// + /// Desc:创建人 + /// Default: + /// Nullable:True + /// + [SugarColumn(ColumnName = "created_by")] + public string createdBy { get; set; } + + /// + /// Desc:创建时间 + /// Default: + /// Nullable:True + /// + [SugarColumn(ColumnName = "created_time")] + public DateTime? createdTime { get; set; } + + /// + /// Desc:更新人 + /// Default: + /// Nullable:True + /// + [SugarColumn(ColumnName = "updated_by")] + public string updatedBy { get; set; } + + /// + /// Desc:更新时间 + /// Default: + /// Nullable:True + /// + [SugarColumn(ColumnName = "updated_time")] + public DateTime? updatedTime { get; set; } + + +} \ No newline at end of file diff --git a/Sln.Wcs.Model/Domain/BaseLocationInfo.cs b/Sln.Wcs.Model/Domain/BaseLocationInfo.cs index 83194e7..6f0ea9a 100644 --- a/Sln.Wcs.Model/Domain/BaseLocationInfo.cs +++ b/Sln.Wcs.Model/Domain/BaseLocationInfo.cs @@ -107,14 +107,6 @@ namespace Sln.Wcs.Model.Domain [SugarColumn(ColumnName = "agv_position")] public string agvPosition { get; set; } - /// - /// Desc:关联设备编号 - /// Default: - /// Nullable:True - /// - [SugarColumn(ColumnName = "device_code")] - public string deviceCode { get; set; } - /// /// Desc:物料编号 /// Default: diff --git a/Sln.Wcs.Repository/service/IBaseDeviceHostService.cs b/Sln.Wcs.Repository/service/IBaseDeviceHostService.cs new file mode 100644 index 0000000..3f66eac --- /dev/null +++ b/Sln.Wcs.Repository/service/IBaseDeviceHostService.cs @@ -0,0 +1,34 @@ +#region << 版 本 注 释 >> + +/*-------------------------------------------------------------------- +* 版权所有 (c) 2026 WenJY 保留所有权利。 +* CLR版本:4.0.30319.42000 +* 机器名称:Mr.Wen's MacBook Pro +* 命名空间:Sln.Wcs.Repository.service +* 唯一标识:3D8934A2-7CF5-41B8-957E-91F649F04296 +* +* 创建者:WenJY +* 电子邮箱: +* 创建时间:2026-05-06 16:23:16 +* 版本:V1.0.0 +* 描述: +* +*-------------------------------------------------------------------- +* 修改人: +* 时间: +* 修改说明: +* +* 版本:V1.0.0 +*--------------------------------------------------------------------*/ + +#endregion << 版 本 注 释 >> + +using Sln.Wcs.Model.Domain; +using Sln.Wcs.Repository.service.@base; + +namespace Sln.Wcs.Repository.service; + +public interface IBaseDeviceHostService: IBaseService +{ + +} \ No newline at end of file diff --git a/Sln.Wcs.Repository/service/IBaseDeviceParamService.cs b/Sln.Wcs.Repository/service/IBaseDeviceParamService.cs new file mode 100644 index 0000000..8179129 --- /dev/null +++ b/Sln.Wcs.Repository/service/IBaseDeviceParamService.cs @@ -0,0 +1,34 @@ +#region << 版 本 注 释 >> + +/*-------------------------------------------------------------------- +* 版权所有 (c) 2026 WenJY 保留所有权利。 +* CLR版本:4.0.30319.42000 +* 机器名称:Mr.Wen's MacBook Pro +* 命名空间:Sln.Wcs.Repository.service +* 唯一标识:8F3726BA-7F1E-4226-AFC5-90B8CB42F280 +* +* 创建者:WenJY +* 电子邮箱: +* 创建时间:2026-05-06 16:24:22 +* 版本:V1.0.0 +* 描述: +* +*-------------------------------------------------------------------- +* 修改人: +* 时间: +* 修改说明: +* +* 版本:V1.0.0 +*--------------------------------------------------------------------*/ + +#endregion << 版 本 注 释 >> + +using Sln.Wcs.Model.Domain; +using Sln.Wcs.Repository.service.@base; + +namespace Sln.Wcs.Repository.service; + +public interface IBaseDeviceParamService:IBaseService +{ + +} \ No newline at end of file diff --git a/Sln.Wcs.Repository/service/Impl/BaseDeviceHostServiceImpl.cs b/Sln.Wcs.Repository/service/Impl/BaseDeviceHostServiceImpl.cs new file mode 100644 index 0000000..6ab5b12 --- /dev/null +++ b/Sln.Wcs.Repository/service/Impl/BaseDeviceHostServiceImpl.cs @@ -0,0 +1,36 @@ +#region << 版 本 注 释 >> + +/*-------------------------------------------------------------------- +* 版权所有 (c) 2026 WenJY 保留所有权利。 +* CLR版本:4.0.30319.42000 +* 机器名称:Mr.Wen's MacBook Pro +* 命名空间:Sln.Wcs.Repository.service.Impl +* 唯一标识:80C658D8-6B6E-430F-BFD4-0AC87AD5D8AA +* +* 创建者:WenJY +* 电子邮箱: +* 创建时间:2026-05-06 16:23:42 +* 版本:V1.0.0 +* 描述: +* +*-------------------------------------------------------------------- +* 修改人: +* 时间: +* 修改说明: +* +* 版本:V1.0.0 +*--------------------------------------------------------------------*/ + +#endregion << 版 本 注 释 >> + +using Sln.Wcs.Model.Domain; +using Sln.Wcs.Repository.service.@base; + +namespace Sln.Wcs.Repository.service.Impl; + +public class BaseDeviceHostServiceImpl: BaseServiceImpl, IBaseDeviceHostService +{ + public BaseDeviceHostServiceImpl(Repository rep) : base(rep) + { + } +} \ No newline at end of file diff --git a/Sln.Wcs.Repository/service/Impl/BaseDeviceParamServiceImpl.cs b/Sln.Wcs.Repository/service/Impl/BaseDeviceParamServiceImpl.cs new file mode 100644 index 0000000..a005b27 --- /dev/null +++ b/Sln.Wcs.Repository/service/Impl/BaseDeviceParamServiceImpl.cs @@ -0,0 +1,36 @@ +#region << 版 本 注 释 >> + +/*-------------------------------------------------------------------- +* 版权所有 (c) 2026 WenJY 保留所有权利。 +* CLR版本:4.0.30319.42000 +* 机器名称:Mr.Wen's MacBook Pro +* 命名空间:Sln.Wcs.Repository.service.Impl +* 唯一标识:60056210-22A3-4E6D-AB0C-65B15E6A9524 +* +* 创建者:WenJY +* 电子邮箱: +* 创建时间:2026-05-06 16:24:49 +* 版本:V1.0.0 +* 描述: +* +*-------------------------------------------------------------------- +* 修改人: +* 时间: +* 修改说明: +* +* 版本:V1.0.0 +*--------------------------------------------------------------------*/ + +#endregion << 版 本 注 释 >> + +using Sln.Wcs.Model.Domain; +using Sln.Wcs.Repository.service.@base; + +namespace Sln.Wcs.Repository.service.Impl; + +public class BaseDeviceParamServiceImpl: BaseServiceImpl, IBaseDeviceParamService +{ + public BaseDeviceParamServiceImpl(Repository rep) : base(rep) + { + } +} \ No newline at end of file diff --git a/Sln.Wcs/ORMUnitTest.cs b/Sln.Wcs/ORMUnitTest.cs new file mode 100644 index 0000000..324313c --- /dev/null +++ b/Sln.Wcs/ORMUnitTest.cs @@ -0,0 +1,51 @@ +#region << 版 本 注 释 >> + +/*-------------------------------------------------------------------- +* 版权所有 (c) 2026 WenJY 保留所有权利。 +* CLR版本:4.0.30319.42000 +* 机器名称:Mr.Wen's MacBook Pro +* 命名空间:Sln.Wcs +* 唯一标识:F7EA6701-5E97-4203-9DC0-16EABB5EF94B +* +* 创建者:WenJY +* 电子邮箱: +* 创建时间:2026-05-06 16:26:13 +* 版本:V1.0.0 +* 描述: +* +*-------------------------------------------------------------------- +* 修改人: +* 时间: +* 修改说明: +* +* 版本:V1.0.0 +*--------------------------------------------------------------------*/ + +#endregion << 版 本 注 释 >> + +using Sln.Wcs.Model.Domain; +using Sln.Wcs.Repository.service; + +namespace Sln.Wcs; + +public class ORMUnitTest +{ + private readonly IBaseDeviceHostService baseDeviceHostService; + + public ORMUnitTest(IBaseDeviceHostService baseDeviceHostService) + { + this.baseDeviceHostService = baseDeviceHostService; + } + + public void Run() + { + BaseDeviceHost deviceHost = new BaseDeviceHost(); + deviceHost.hostCode = "1#Host"; + deviceHost.hostName = "1#PLC"; + deviceHost.hostIP = "127.0.0.1"; + deviceHost.hostPort = 9600; + var res = this.baseDeviceHostService.Insert(deviceHost); + + var info = this.baseDeviceHostService.Query(); + } +} \ No newline at end of file diff --git a/Sln.Wcs/Program.cs b/Sln.Wcs/Program.cs index 3690ff8..4945aa3 100644 --- a/Sln.Wcs/Program.cs +++ b/Sln.Wcs/Program.cs @@ -30,7 +30,6 @@ namespace Sln.Wcs var log = serviceProvider.GetService(); log.Info($"系统启动成功,日志存放位置:{config["logPath"]}"); - } private static void ConfigureServices(IServiceCollection services)