Compare commits

...

10 Commits

@ -0,0 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>

@ -0,0 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="NeoSmart.Caching.Sqlite" Version="9.0.1" />
<PackageReference Include="ZiggyCreatures.FusionCache" Version="2.4.0" />
<PackageReference Include="ZiggyCreatures.FusionCache.Serialization.NewtonsoftJson" Version="2.4.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Sln.Wcs.Repository\Sln.Wcs.Repository.csproj" />
<ProjectReference Include="..\Sln.Wcs.Serilog\Sln.Wcs.Serilog.csproj" />
</ItemGroup>
</Project>

@ -0,0 +1,56 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
#region << 版 本 注 释 >>
/*--------------------------------------------------------------------
* (c) 2026 WenJY
* CLR4.0.30319.42000
* T14-GEN3-7895
* Sln.Wcs.Model.Configs
* f0583d35-2981-40a9-a8e7-bdd3d62730e2
*
* WenJY
*
* 2026-03-19 11:15:30
* V1.0.0
*
*
*--------------------------------------------------------------------
*
*
*
*
* V1.0.0
*--------------------------------------------------------------------*/
#endregion << 版 本 注 释 >>
namespace Sln.Wcs.Model.Configs
{
/// <summary>
/// Sql连接配置
/// </summary>
public class SqlConfig
{
/// <summary>
/// Sql 配置ID实体通过该ID关联数据源
/// </summary>
public string configId { get; set; }
/// <summary>
/// 数据库类型MySql-0;SqlServer-1;Sqlite-2;Oracle-3
/// </summary>
public int dbType { get; set; }
/// <summary>
/// 是否启用true-是false-否
/// </summary>
public bool isFlag { get; set; }
/// <summary>
/// 连接字符串
/// </summary>
public string connStr { get; set; }
}
}

@ -0,0 +1,126 @@
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
#region << 版 本 注 释 >>
/*--------------------------------------------------------------------
* (c) 2026 WenJY
* CLR4.0.30319.42000
* T14-GEN3-7895
* Sln.Wcs.Model.Domain
* 083c9c2b-6e5e-422e-bd25-bfaf9b3a9f22
*
* WenJY
*
* 2026-03-25 16:20:18
* V1.0.0
*
*
*--------------------------------------------------------------------
*
*
*
*
* V1.0.0
*--------------------------------------------------------------------*/
#endregion << 版 本 注 释 >>
namespace Sln.Wcs.Model.Domain
{
///<summary>
///设备信息
///</summary>
[SugarTable("base_device_info"), TenantAttribute("core")]
public class BaseDeviceInfo
{
/// <summary>
/// Desc:主键标识
/// Default:
/// Nullable:False
/// </summary>
[SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnName = "obj_id")]
public int objId { get; set; }
/// <summary>
/// Desc:设备编号
/// Default:
/// Nullable:False
/// </summary>
[SugarColumn(ColumnName = "device_code")]
public string deviceCode { get; set; }
/// <summary>
/// Desc:设备名称
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "device_name")]
public string deviceName { get; set; }
/// <summary>
/// Desc:设备类型0-输送线1-AGV2-提升机
/// Default:0
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "device_type")]
public int? deviceType { get; set; }
/// <summary>
/// Desc:设备状态0-正常1-在忙2-异常
/// Default:0
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "device_status")]
public int? deviceStatus { get; set; }
/// <summary>
/// Desc:是否标识1-是0-否
/// Default:0
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "is_flag")]
public int? isFlag { get; set; }
/// <summary>
/// Desc:备注
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "remark")]
public string remark { get; set; }
/// <summary>
/// Desc:创建人
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "created_by")]
public string createdBy { get; set; }
/// <summary>
/// Desc:创建时间
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "created_time")]
public DateTime? createdTime { get; set; }
/// <summary>
/// Desc:更新人
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "updated_by")]
public string updatedBy { get; set; }
/// <summary>
/// Desc:更新时间
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "updated_time")]
public DateTime? updatedTime { get; set; }
}
}

@ -0,0 +1,198 @@
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
#region << 版 本 注 释 >>
/*--------------------------------------------------------------------
* (c) 2026 WenJY
* CLR4.0.30319.42000
* T14-GEN3-7895
* Sln.Wcs.Model.Domain
* 330ca081-4696-4624-ba20-b00dc20a6369
*
* WenJY
*
* 2026-03-25 16:20:32
* V1.0.0
*
*
*--------------------------------------------------------------------
*
*
*
*
* V1.0.0
*--------------------------------------------------------------------*/
#endregion << 版 本 注 释 >>
namespace Sln.Wcs.Model.Domain
{
///<summary>
///库位信息
///</summary>
[SugarTable("base_location_info"), TenantAttribute("core")]
public class BaseLocationInfo
{
/// <summary>
/// Desc:主键标识
/// Default:
/// Nullable:False
/// </summary>
[SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnName = "obj_id")]
public int objId { get; set; }
/// <summary>
/// Desc:库位编号
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "location_code")]
public string locationCode { get; set; }
/// <summary>
/// Desc:库位名称
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "location_name")]
public string locationName { get; set; }
/// <summary>
/// Desc:库位区域
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "location_area")]
public string locationArea { get; set; }
/// <summary>
/// Desc:所属仓库
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "store_code")]
public string storeCode { get; set; }
/// <summary>
/// Desc:排
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "location_rows")]
public int? locationRows { get; set; }
/// <summary>
/// Desc:列
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "location_columns")]
public int? locationColumns { get; set; }
/// <summary>
/// Desc:层
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "location_layers")]
public int? locationLayers { get; set; }
/// <summary>
/// Desc:AGV定位
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "agv_position")]
public string agvPosition { get; set; }
/// <summary>
/// Desc:关联设备编号
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "device_code")]
public string deviceCode { get; set; }
/// <summary>
/// Desc:物料编号
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "material_code")]
public string materialCode { get; set; }
/// <summary>
/// Desc:托盘条码
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "pallet_barcode")]
public string palletBarcode { get; set; }
/// <summary>
/// Desc:库存数量
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "stack_count")]
public string stackCount { get; set; }
/// <summary>
/// Desc:库位状态;0-未使用;1-已使用;2-锁库;3-异常
/// Default:0
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "location_status")]
public int? locationStatus { get; set; }
/// <summary>
/// Desc:是否标识1-是0-否
/// Default:0
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "is_flag")]
public int? isFlag { get; set; }
/// <summary>
/// Desc:备注
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "remark")]
public string remark { get; set; }
/// <summary>
/// Desc:创建人
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "created_by")]
public string createdBy { get; set; }
/// <summary>
/// Desc:创建时间
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "created_time")]
public DateTime? createdTime { get; set; }
/// <summary>
/// Desc:更新人
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "updated_by")]
public string updatedBy { get; set; }
/// <summary>
/// Desc:更新时间
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "updated_time")]
public DateTime? updatedTime { get; set; }
}
}

@ -0,0 +1,142 @@
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
#region << 版 本 注 释 >>
/*--------------------------------------------------------------------
* (c) 2026 WenJY
* CLR4.0.30319.42000
* T14-GEN3-7895
* Sln.Wcs.Model.Domain
* ef416a98-ba06-4357-8296-665f9688477b
*
* WenJY
*
* 2026-03-25 16:20:43
* V1.0.0
*
*
*--------------------------------------------------------------------
*
*
*
*
* V1.0.0
*--------------------------------------------------------------------*/
#endregion << 版 本 注 释 >>
namespace Sln.Wcs.Model.Domain
{
///<summary>
///物料信息
///</summary>
[SugarTable("base_material_info"), TenantAttribute("core")]
public class BaseMaterialInfo
{
/// <summary>
/// Desc:主键标识
/// Default:
/// Nullable:False
/// </summary>
[SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnName = "obj_id")]
public int objId { get; set; }
/// <summary>
/// Desc:物料编号
/// Default:
/// Nullable:False
/// </summary>
[SugarColumn(ColumnName = "material_code")]
public string materialCode { get; set; }
/// <summary>
/// Desc:物料名称
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "material_name")]
public string materialName { get; set; }
/// <summary>
/// Desc:物料类型
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "material_type")]
public string materialType { get; set; }
/// <summary>
/// Desc:物料条码
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "material_barcode")]
public string materialBarcode { get; set; }
/// <summary>
/// Desc:最短存放周期
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "min_storage_cycle")]
public int? minStorageCycle { get; set; }
/// <summary>
/// Desc:最长存放周期
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "max_storage_cycle")]
public int? maxStorageCycle { get; set; }
/// <summary>
/// Desc:是否标识1-是0-否
/// Default:0
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "is_flag")]
public int? isFlag { get; set; }
/// <summary>
/// Desc:备注
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "remark")]
public string remark { get; set; }
/// <summary>
/// Desc:创建人
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "created_by")]
public string createdBy { get; set; }
/// <summary>
/// Desc:创建时间
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "created_time")]
public DateTime? createdTime { get; set; }
/// <summary>
/// Desc:更新人
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "updated_by")]
public string updatedBy { get; set; }
/// <summary>
/// Desc:更新时间
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "updated_time")]
public DateTime? updatedTime { get; set; }
}
}

@ -0,0 +1,118 @@
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
#region << 版 本 注 释 >>
/*--------------------------------------------------------------------
* (c) 2026 WenJY
* CLR4.0.30319.42000
* T14-GEN3-7895
* Sln.Wcs.Model.Domain
* 05fbbc8d-2392-4da0-904e-3f6d689d2c88
*
* WenJY
*
* 2026-03-25 16:21:07
* V1.0.0
*
*
*--------------------------------------------------------------------
*
*
*
*
* V1.0.0
*--------------------------------------------------------------------*/
#endregion << 版 本 注 释 >>
namespace Sln.Wcs.Model.Domain
{
///<summary>
///路径明细
///</summary>
[SugarTable("base_path_details"), TenantAttribute("core")]
public class BasePathDetails
{
/// <summary>
/// Desc:主键标识
/// Default:
/// Nullable:False
/// </summary>
[SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnName = "obj_id")]
public int objId { get; set; }
/// <summary>
/// Desc:路径编号
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "path_code")]
public string pathCode { get; set; }
/// <summary>
/// Desc:起点
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "start_point")]
public string startPoint { get; set; }
/// <summary>
/// Desc:终点
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "end_point")]
public string endPoint { get; set; }
/// <summary>
/// Desc:是否标识1-是0-否
/// Default:0
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "is_flag")]
public int? isFlag { get; set; }
/// <summary>
/// Desc:备注
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "remark")]
public string remark { get; set; }
/// <summary>
/// Desc:创建人
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "created_by")]
public string createdBy { get; set; }
/// <summary>
/// Desc:创建时间
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "created_time")]
public DateTime? createdTime { get; set; }
/// <summary>
/// Desc:更新人
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "updated_by")]
public string updatedBy { get; set; }
/// <summary>
/// Desc:更新时间
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "updated_time")]
public DateTime? updatedTime { get; set; }
}
}

@ -0,0 +1,110 @@
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
#region << 版 本 注 释 >>
/*--------------------------------------------------------------------
* (c) 2026 WenJY
* CLR4.0.30319.42000
* T14-GEN3-7895
* Sln.Wcs.Model.Domain
* 32362551-1f9c-48c5-aec5-8e784b48a90b
*
* WenJY
*
* 2026-03-25 16:20:55
* V1.0.0
*
*
*--------------------------------------------------------------------
*
*
*
*
* V1.0.0
*--------------------------------------------------------------------*/
#endregion << 版 本 注 释 >>
namespace Sln.Wcs.Model.Domain
{
///<summary>
///路径信息
///</summary>
[SugarTable("base_path_info"), TenantAttribute("core")]
public class BasePathInfo
{
/// <summary>
/// Desc:主键标识
/// Default:
/// Nullable:False
/// </summary>
[SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnName = "obj_id")]
public int objId { get; set; }
/// <summary>
/// Desc:路径编号
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "path_code")]
public string pathCode { get; set; }
/// <summary>
/// Desc:路径名称
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "path_name")]
public string pathName { get; set; }
/// <summary>
/// Desc:是否标识1-是0-否
/// Default:0
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "is_flag")]
public int? isFlag { get; set; }
/// <summary>
/// Desc:备注
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "remark")]
public string remark { get; set; }
/// <summary>
/// Desc:创建人
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "created_by")]
public string createdBy { get; set; }
/// <summary>
/// Desc:创建时间
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "created_time")]
public DateTime? createdTime { get; set; }
/// <summary>
/// Desc:更新人
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "updated_by")]
public string updatedBy { get; set; }
/// <summary>
/// Desc:更新时间
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "updated_time")]
public DateTime? updatedTime { get; set; }
}
}

@ -0,0 +1,110 @@
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
#region << 版 本 注 释 >>
/*--------------------------------------------------------------------
* (c) 2026 WenJY
* CLR4.0.30319.42000
* T14-GEN3-7895
* Sln.Wcs.Model.Domain
* 1662ee15-9ae3-4e65-9801-3244af44103f
*
* WenJY
*
* 2026-03-25 16:21:18
* V1.0.0
*
*
*--------------------------------------------------------------------
*
*
*
*
* V1.0.0
*--------------------------------------------------------------------*/
#endregion << 版 本 注 释 >>
namespace Sln.Wcs.Model.Domain
{
///<summary>
///仓库信息
///</summary>
[SugarTable("base_store_info"), TenantAttribute("core")]
public class BaseStoreInfo
{
/// <summary>
/// Desc:主键标识
/// Default:
/// Nullable:False
/// </summary>
[SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnName = "obj_id")]
public int objId { get; set; }
/// <summary>
/// Desc:仓库编号
/// Default:
/// Nullable:False
/// </summary>
[SugarColumn(ColumnName = "store_code")]
public string storeCode { get; set; }
/// <summary>
/// Desc:仓库名称
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "store_name")]
public string storeName { get; set; }
/// <summary>
/// Desc:是否表示1-是0-否
/// Default:0
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "is_flag")]
public int? isFlag { get; set; }
/// <summary>
/// Desc:备注
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "remark")]
public string remark { get; set; }
/// <summary>
/// Desc:创建人
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "created_by")]
public string createdBy { get; set; }
/// <summary>
/// Desc:创建时间
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "created_time")]
public DateTime? createdTime { get; set; }
/// <summary>
/// Desc:更新人
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "updated_by")]
public string updatedBy { get; set; }
/// <summary>
/// Desc:更新时间
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "updated_time")]
public DateTime? updatedTime { get; set; }
}
}

@ -6,4 +6,12 @@
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<Folder Include="Dto\" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="SqlSugarCore" Version="5.1.4.214" />
</ItemGroup>
</Project>

@ -0,0 +1,136 @@
#region << 版 本 注 释 >>
/*--------------------------------------------------------------------
* (c) 2024 WenJY
* CLR4.0.30319.42000
* LAPTOP-E0N2L34V
* SlnMesnac.Plc
* 496f8d2b-70e3-4a05-ae18-a9b0fcd06b82
*
* WenJY
* wenjy@mesnac.com
* 2024-03-27 21:58:35
* V1.0.0
*
*
*--------------------------------------------------------------------
*
*
*
*
* V1.0.0
*--------------------------------------------------------------------*/
#endregion << 版 本 注 释 >>
using System.Threading.Tasks;
namespace Sln.Wcs.Plc
{
public abstract class PlcAbsractFactory
{
public string ConfigKey { get; set; }
/// <summary>
/// 是否连接
/// </summary>
public abstract bool IsConnected { get; set; }
/// <summary>
/// 建立连接
/// </summary>
/// <param name="ip"></param>
/// <param name="port"></param>
/// <returns></returns>
public abstract bool Connect(string ip, int port);
/// <summary>
/// 异步建立连接
/// </summary>
/// <param name="ip"></param>
/// <param name="port"></param>
/// <returns></returns>
public abstract Task<bool> ConnectAsync(string ip, int port);
/// <summary>
/// 断开连接
/// </summary>
/// <returns></returns>
public abstract bool DisConnect();
/// <summary>
/// 根据地址读取指定长度数据
/// </summary>
/// <param name="address"></param>
/// <param name="len"></param>
/// <returns></returns>
public abstract byte[] readValueByAddress(string address, int len);
/// <summary>
/// 通过PLC地址读取int16类型数据
/// </summary>
/// <param name="address"></param>
/// <returns></returns>
public abstract int readInt16ByAddress(string address);
/// <summary>
/// 通过PLC地址写入int16类型数据
/// </summary>
/// <param name="address"></param>
/// <param name="value"></param>
/// <returns></returns>
public abstract bool writeInt16ByAddress(string address, int value);
/// <summary>
/// 通过PLC地址读取string类型数据
/// </summary>
/// <param name="address"></param>
/// <returns></returns>
public abstract string readStringByAddress(string address, ushort length);
/// <summary>
/// 弃用--通过PLC地址写入String类型数据
/// </summary>
/// <param name="address"></param>
/// <param name="SFC"></param>
/// <returns></returns>
public abstract bool writeStringByAddress(string address, string value);
/// <summary>
/// 使用--通过PLC地址写入String类型数据
/// </summary>
/// <param name="address"></param>
/// <param name="SFC"></param>
/// <returns></returns>
public abstract bool writeStringByAddress(string address, string value, int length);
/// <summary>
/// 通过PLC地址读取Bool类型数据
/// </summary>
/// <param name="address"></param>
/// <returns></returns>
public abstract bool readBoolByAddress(string address);
/// <summary>
/// 通过PLC地址读取心跳结果
/// </summary>
/// <param name="address"></param>
/// <returns></returns>
public abstract bool readHeartByAddress(string address);
/// <summary>
/// 通过PLC地址写入Bool类型数据
/// </summary>
/// <param name="address"></param>
/// <returns></returns>
public abstract bool writeBoolByAddress(string address, bool value);
/// <summary>
/// 通过PLC地址写入Double类型数据
/// </summary>
/// <param name="address"></param>
/// <param name="value"></param>
/// <returns></returns>
public abstract bool writeDoubleByAddress(string address, int value);
}
}

@ -0,0 +1,22 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="HslCommunication" Version="12.6.3" />
<PackageReference Include="Microsoft.AspNetCore.Http.Abstractions" Version="2.3.9" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="10.0.4" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Sln.Wcs.Common\Sln.Wcs.Common.csproj" />
</ItemGroup>
<ItemGroup>
<Folder Include="Factory\" />
</ItemGroup>
</Project>

@ -0,0 +1,45 @@
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
#region << 版 本 注 释 >>
/*--------------------------------------------------------------------
* (c) 2026 WenJY
* CLR4.0.30319.42000
* T14-GEN3-7895
* Sln.Wcs.Repository
* ba49de90-3c8c-447a-889a-a5fc34514709
*
* WenJY
*
* 2026-03-19 11:27:11
* V1.0.0
*
*
*--------------------------------------------------------------------
*
*
*
*
* V1.0.0
*--------------------------------------------------------------------*/
#endregion << 版 本 注 释 >>
namespace Sln.Wcs.Repository
{
public class Repository<T> : SimpleClient<T> where T : class, new()
{
public ITenant itenant = null; //多租户事务、GetConnection、IsAnyConnection等功能
public Repository(ISqlSugarClient db)
{
itenant = db.AsTenant(); //用来处理事务
base.Context = db.AsTenant().GetConnectionScopeWithAttr<T>(); //获取子Db
//如果不想通过注入多个仓储
//用到ChangeRepository或者Db.GetMyRepository需要看标题4写法
}
}
}

@ -0,0 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="10.0.3" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="10.0.4" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Sln.Wcs.Model\Sln.Wcs.Model.csproj" />
</ItemGroup>
</Project>

@ -0,0 +1,77 @@
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Identity.Client;
using Newtonsoft.Json;
using Sln.Wcs.Model.Configs;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
#region << 版 本 注 释 >>
/*--------------------------------------------------------------------
* (c) 2026 WenJY
* CLR4.0.30319.42000
* T14-GEN3-7895
* Sln.Wcs.Repository
* 705f0413-0af8-472c-adea-cf7b42540220
*
* WenJY
*
* 2026-03-19 11:17:45
* V1.0.0
*
*
*--------------------------------------------------------------------
*
*
*
*
* V1.0.0
*--------------------------------------------------------------------*/
#endregion << 版 本 注 释 >>
namespace Sln.Wcs.Repository
{
public static class SqlsugarSetup
{
/// <summary>
/// 注册SqlSugar
/// </summary>
/// <param name="services"></param>
public static void AddSqlSugarSetup(this IServiceCollection services)
{
services.AddSingleton<ISqlSugarClient>(x =>
{
var configuration = x.GetService<IConfiguration>();
List<SqlConfig> sqlConfigs = JsonConvert.DeserializeObject<List<SqlConfig>>(configuration["sqlConfigs"]);
var connectConfigList = new List<ConnectionConfig>();
if (sqlConfigs != null)
{
foreach (var item in sqlConfigs)
{
if (item.isFlag)
{
var config = new ConnectionConfig()
{
ConfigId = item.configId,
DbType = (DbType)item.dbType,
ConnectionString = item.connStr,
InitKeyType = InitKeyType.Attribute,
IsAutoCloseConnection = true,
};
connectConfigList.Add(config);
}
}
}
SqlSugarScope Db =
new SqlSugarScope(connectConfigList, db => { db.Aop.OnLogExecuting = (sql, pars) => { }; });
return Db;
});
}
}
}

@ -0,0 +1,14 @@
using Sln.Wcs.Model.Domain;
using Sln.Wcs.Repository.service.@base;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Sln.Wcs.Repository.service
{
public interface IBaseDeviceInfoService : IBaseService<BaseDeviceInfo>
{
}
}

@ -0,0 +1,14 @@
using Sln.Wcs.Model.Domain;
using Sln.Wcs.Repository.service.@base;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Sln.Wcs.Repository.service
{
public interface IBaseLocationInfoService:IBaseService<BaseLocationInfo>
{
}
}

@ -0,0 +1,14 @@
using Sln.Wcs.Model.Domain;
using Sln.Wcs.Repository.service.@base;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Sln.Wcs.Repository.service
{
public interface IBaseMaterialInfoService:IBaseService<BaseMaterialInfo>
{
}
}

@ -0,0 +1,14 @@
using Sln.Wcs.Model.Domain;
using Sln.Wcs.Repository.service.@base;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Sln.Wcs.Repository.service
{
public interface IBasePathDetailsService:IBaseService<BasePathDetails>
{
}
}

@ -0,0 +1,14 @@
using Sln.Wcs.Model.Domain;
using Sln.Wcs.Repository.service.@base;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Sln.Wcs.Repository.service
{
public interface IBasePathInfoService:IBaseService<BasePathInfo>
{
}
}

@ -0,0 +1,14 @@
using Sln.Wcs.Model.Domain;
using Sln.Wcs.Repository.service.@base;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Sln.Wcs.Repository.service
{
public interface IBaseStoreInfoService:IBaseService<BaseStoreInfo>
{
}
}

@ -0,0 +1,39 @@
using Sln.Wcs.Model.Domain;
using Sln.Wcs.Repository.service.@base;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
#region << 版 本 注 释 >>
/*--------------------------------------------------------------------
* (c) 2026 WenJY
* CLR4.0.30319.42000
* T14-GEN3-7895
* Sln.Wcs.Repository.service.Impl
* 6990ddb2-4013-42e6-b721-ef9ae41bcf70
*
* WenJY
*
* 2026-03-25 16:31:19
* V1.0.0
*
*
*--------------------------------------------------------------------
*
*
*
*
* V1.0.0
*--------------------------------------------------------------------*/
#endregion << 版 本 注 释 >>
namespace Sln.Wcs.Repository.service.Impl
{
public class BaseDeviceInfoServiceImpl : BaseServiceImpl<BaseDeviceInfo>, IBaseDeviceInfoService
{
public BaseDeviceInfoServiceImpl(Repository<BaseDeviceInfo> rep) : base(rep)
{
}
}
}

@ -0,0 +1,39 @@
using Sln.Wcs.Model.Domain;
using Sln.Wcs.Repository.service.@base;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
#region << 版 本 注 释 >>
/*--------------------------------------------------------------------
* (c) 2026 WenJY
* CLR4.0.30319.42000
* T14-GEN3-7895
* Sln.Wcs.Repository.service.Impl
* e4191f7c-0aa2-4437-9195-a4e001395e85
*
* WenJY
*
* 2026-03-25 16:32:22
* V1.0.0
*
*
*--------------------------------------------------------------------
*
*
*
*
* V1.0.0
*--------------------------------------------------------------------*/
#endregion << 版 本 注 释 >>
namespace Sln.Wcs.Repository.service.Impl
{
public class BaseLocationInfoServiceImpl : BaseServiceImpl<BaseLocationInfo>, IBaseLocationInfoService
{
public BaseLocationInfoServiceImpl(Repository<BaseLocationInfo> rep) : base(rep)
{
}
}
}

@ -0,0 +1,39 @@
using Sln.Wcs.Model.Domain;
using Sln.Wcs.Repository.service.@base;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
#region << 版 本 注 释 >>
/*--------------------------------------------------------------------
* (c) 2026 WenJY
* CLR4.0.30319.42000
* T14-GEN3-7895
* Sln.Wcs.Repository.service.Impl
* f8b5ccd9-4625-449a-b066-fe976b3db770
*
* WenJY
*
* 2026-03-25 16:33:05
* V1.0.0
*
*
*--------------------------------------------------------------------
*
*
*
*
* V1.0.0
*--------------------------------------------------------------------*/
#endregion << 版 本 注 释 >>
namespace Sln.Wcs.Repository.service.Impl
{
public class BaseMaterialInfoServiceImpl : BaseServiceImpl<BaseMaterialInfo>, IBaseMaterialInfoService
{
public BaseMaterialInfoServiceImpl(Repository<BaseMaterialInfo> rep) : base(rep)
{
}
}
}

@ -0,0 +1,39 @@
using Sln.Wcs.Model.Domain;
using Sln.Wcs.Repository.service.@base;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
#region << 版 本 注 释 >>
/*--------------------------------------------------------------------
* (c) 2026 WenJY
* CLR4.0.30319.42000
* T14-GEN3-7895
* Sln.Wcs.Repository.service.Impl
* 0639e100-f810-46fb-b590-82ff4b4eedd5
*
* WenJY
*
* 2026-03-25 16:34:17
* V1.0.0
*
*
*--------------------------------------------------------------------
*
*
*
*
* V1.0.0
*--------------------------------------------------------------------*/
#endregion << 版 本 注 释 >>
namespace Sln.Wcs.Repository.service.Impl
{
public class BasePathDetailsServiceImpl : BaseServiceImpl<BasePathDetails>, IBasePathDetailsService
{
public BasePathDetailsServiceImpl(Repository<BasePathDetails> rep) : base(rep)
{
}
}
}

@ -0,0 +1,39 @@
using Sln.Wcs.Model.Domain;
using Sln.Wcs.Repository.service.@base;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
#region << 版 本 注 释 >>
/*--------------------------------------------------------------------
* (c) 2026 WenJY
* CLR4.0.30319.42000
* T14-GEN3-7895
* Sln.Wcs.Repository.service.Impl
* 0603d318-2ae9-474e-a474-586ac1a1b9f6
*
* WenJY
*
* 2026-03-25 16:34:47
* V1.0.0
*
*
*--------------------------------------------------------------------
*
*
*
*
* V1.0.0
*--------------------------------------------------------------------*/
#endregion << 版 本 注 释 >>
namespace Sln.Wcs.Repository.service.Impl
{
public class BasePathInfoServiceImpl : BaseServiceImpl<BasePathInfo>, IBasePathInfoService
{
public BasePathInfoServiceImpl(Repository<BasePathInfo> rep) : base(rep)
{
}
}
}

@ -0,0 +1,39 @@
using Sln.Wcs.Model.Domain;
using Sln.Wcs.Repository.service.@base;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
#region << 版 本 注 释 >>
/*--------------------------------------------------------------------
* (c) 2026 WenJY
* CLR4.0.30319.42000
* T14-GEN3-7895
* Sln.Wcs.Repository.service.Impl
* e57e4328-bde4-4943-843a-af619537db3b
*
* WenJY
*
* 2026-03-25 16:35:17
* V1.0.0
*
*
*--------------------------------------------------------------------
*
*
*
*
* V1.0.0
*--------------------------------------------------------------------*/
#endregion << 版 本 注 释 >>
namespace Sln.Wcs.Repository.service.Impl
{
public class BaseStoreInfoServiceImpl : BaseServiceImpl<BaseStoreInfo>, IBaseStoreInfoService
{
public BaseStoreInfoServiceImpl(Repository<BaseStoreInfo> rep) : base(rep)
{
}
}
}

@ -0,0 +1,371 @@
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
#region << 版 本 注 释 >>
/*--------------------------------------------------------------------
* (c) 2026 WenJY
* CLR4.0.30319.42000
* T14-GEN3-7895
* Sln.Wcs.Repository.base
* d7a87113-4748-4683-8291-a0a724f94e44
*
* WenJY
*
* 2026-03-19 11:28:36
* V1.0.0
*
*
*--------------------------------------------------------------------
*
*
*
*
* V1.0.0
*--------------------------------------------------------------------*/
#endregion << 版 本 注 释 >>
namespace Sln.Wcs.Repository.service.@base
{
public class BaseServiceImpl<T> : IBaseService<T> where T : class, new()
{
public readonly Repository<T> _rep;
public BaseServiceImpl(Repository<T> rep)
{
_rep = rep;
}
/// <summary>
/// 添加实体信息
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
/// <exception cref="ArgumentNullException"></exception>
/// <exception cref="InvalidOperationException"></exception>
public bool Insert(T model)
{
if (model == null)
{
throw new ArgumentNullException($"添加实体信息异常:实体参数为空");
}
try
{
return _rep.CopyNew().Insert(model);
}
catch (Exception ex)
{
throw new InvalidOperationException($"添加实体信息异常:{ex.Message}");
}
}
/// <summary>
/// 批量添加实体集合
/// </summary>
/// <param name="lisT"></param>
/// <returns></returns>
/// <exception cref="ArgumentNullException"></exception>
/// <exception cref="InvalidOperationException"></exception>
public bool Insert(List<T> lisT)
{
if (lisT == null)
{
throw new ArgumentNullException($"批量添加实体集合异常:实体集合参数为空");
}
try
{
// _rep.AsTenant().BeginTran();
var info = _rep.CopyNew().InsertRange(lisT);
// _rep.AsTenant().CommitTran();
return true;
}
catch (Exception ex)
{
// _rep.AsTenant().RollbackTran();
throw new InvalidOperationException($"批量添加实体集合异常:{ex.Message}");
}
}
/// <summary>
/// 根据id 删除信息
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
public bool DeleteById(object id)
{
if (id == null)
{
throw new ArgumentNullException($"根据id删除信息异常:Id参数为空");
}
try
{
return _rep.DeleteById(id);
}
catch (Exception ex)
{
throw new InvalidOperationException($"根据id删除信息异常:{ex.Message}");
}
}
/// <summary>
/// 根据实体删除信息
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
/// <exception cref="ArgumentNullException"></exception>
/// <exception cref="InvalidOperationException"></exception>
public bool Delete(T model)
{
if (model == null)
{
throw new ArgumentNullException($"根据实体删除信息异常:实体参数为空");
}
try
{
return _rep.DeleteById(model);
}
catch (Exception ex)
{
throw new InvalidOperationException($"根据实体删除信息异常:{ex.Message}");
}
}
/// <summary>
/// 根据实体集合批量删除信息
/// </summary>
/// <param name="entitys"></param>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
public bool Deletes(List<T> entitys)
{
if (entitys == null)
{
throw new ArgumentNullException($"根据实体集合批量删除信息异常:实体集合参数为空");
}
try
{
return _rep.Delete(entitys);
}
catch (Exception ex)
{
throw new InvalidOperationException($"根据实体集合批量删除信息异常:{ex.Message}");
}
}
/// <summary>
/// 根据实体更新信息
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
public bool Update(T model)
{
if (model == null)
{
throw new ArgumentNullException($"根据实体更新信息异常:实体参数为空");
}
try
{
return _rep.Update(model);
}
catch (Exception ex)
{
throw new InvalidOperationException($"根据实体更新信息异常:{ex.Message}");
}
}
/// <summary>
/// 批量更新实体集合信息
/// </summary>
/// <param name="entitys"></param>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
public bool Update(List<T> entitys)
{
if (entitys == null)
{
throw new ArgumentNullException($"批量更新实体集合信息异常:实体集合参数为空");
}
try
{
return _rep.UpdateRange(entitys);
}
catch (Exception ex)
{
throw new InvalidOperationException($"批量更新实体集合信息异常:{ex.Message}");
}
}
/// <summary>
/// 根据Where条件更新实体信息
/// </summary>
/// <param name="entity"></param>
/// <param name="strWhere"></param>
/// <returns></returns>
public bool Update(T entity, string strWhere)
{
if (entity == null)
{
throw new ArgumentNullException($"根据Where条件更新实体信息异常:实体参数为空");
}
if (string.IsNullOrEmpty(strWhere))
{
throw new ArgumentNullException($"根据Where条件更新实体信息异常:Where参数为空");
}
try
{
return _rep.AsUpdateable(entity).Where(strWhere).ExecuteCommandHasChange();
}
catch (Exception ex)
{
throw new InvalidOperationException($"根据Where条件更新实体信息异常:{ex.Message}");
}
}
/// <summary>
/// 根据实体更新指定列
/// </summary>
/// <param name="entity"></param>
/// <param name="lstColumns"></param>
/// <param name="lstIgnoreColumns"></param>
/// <param name="strWhere"></param>
/// <returns></returns>
public bool Update(T entity, List<string> lstColumns = null, List<string> lstIgnoreColumns = null,
string strWhere = "")
{
try
{
IUpdateable<T> up = _rep.AsUpdateable(entity);
if (lstIgnoreColumns != null && lstIgnoreColumns.Count > 0)
{
up = up.IgnoreColumns(lstIgnoreColumns.ToArray());
}
if (lstColumns != null && lstColumns.Count > 0)
{
up = up.UpdateColumns(lstColumns.ToArray());
}
if (!string.IsNullOrEmpty(strWhere))
{
up = up.Where(strWhere);
}
return up.ExecuteCommandHasChange();
}
catch (Exception ex)
{
throw new InvalidOperationException($"根据实体更新指定列异常:{ex.Message}");
}
}
/// <summary>
/// 查询所有信息
/// </summary>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
public List<T> Query()
{
try
{
return _rep.GetList();
}
catch (Exception ex)
{
throw new InvalidOperationException($"查询所有信息异常:{ex.Message}");
}
}
/// <summary>
/// 根据Id查询实体
/// </summary>
/// <param name="objId"></param>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
public T Query(object objId)
{
if (objId == null)
{
throw new ArgumentNullException($"根据Id查询实体信息异常:Id参数为空");
}
try
{
return _rep.GetById(objId);
}
catch (Exception ex)
{
throw new InvalidOperationException($"根据Id查询实体信息异常:{ex.Message}");
}
}
/// <summary>
/// 根据表达式查询
/// </summary>
/// <param name="whereExpression"></param>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
public List<T> Query(Expression<Func<T, bool>> whereExpression)
{
if (whereExpression == null)
{
throw new ArgumentNullException($"根据表达式查询实体信息异常:表达式参数为空");
}
try
{
return _rep.GetList(whereExpression);
}
catch (Exception ex)
{
throw new InvalidOperationException($"根据表达式查询实体信息异常:{ex.Message}");
}
}
/// <summary>
/// 根据表达式排序查询
/// </summary>
/// <param name="whereExpression"></param>
/// <param name="orderByExpression"></param>
/// <param name="isAsc"></param>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
public List<T> Query(Expression<Func<T, bool>> whereExpression, Expression<Func<T, object>> orderByExpression,
bool isAsc = true)
{
if (whereExpression == null)
{
throw new ArgumentNullException($"根据表达式排序查询信息异常:条件表达式参数为空");
}
if (orderByExpression == null)
{
throw new ArgumentNullException($"根据表达式排序查询信息异常:排序表达式参数为空");
}
try
{
return _rep.AsQueryable()
.OrderByIF(orderByExpression != null, orderByExpression, isAsc ? OrderByType.Asc : OrderByType.Desc)
.WhereIF(whereExpression != null, whereExpression).ToList();
}
catch (Exception ex)
{
throw new InvalidOperationException($"根据表达式排序查询信息异常:{ex.Message}");
}
}
}
}

@ -0,0 +1,109 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
namespace Sln.Wcs.Repository.service.@base
{
public interface IBaseService<T> where T : class
{
/// <summary>
/// 添加实体信息
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
bool Insert(T model);
/// <summary>
/// 批量添加实体集合
/// </summary>
/// <param name="lisT"></param>
/// <returns></returns>
bool Insert(List<T> lisT);
/// <summary>
/// 根据id 删除信息
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
bool DeleteById(object id);
/// <summary>
/// 根据实体删除信息
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
bool Delete(T model);
/// <summary>
/// 根据实体集合批量删除信息
/// </summary>
/// <param name="ids"></param>
/// <returns></returns>
bool Deletes(List<T> entitys);
/// <summary>
/// 根据实体更新信息
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
bool Update(T model);
/// <summary>
/// 批量更新实体集合信息
/// </summary>
/// <param name="entitys"></param>
/// <returns></returns>
bool Update(List<T> entitys);
/// <summary>
/// 根据Where条件更新实体信息
/// </summary>
/// <param name="entity"></param>
/// <param name="strWhere"></param>
/// <returns></returns>
bool Update(T entity, string strWhere);
/// <summary>
/// 根据实体更新指定列
/// </summary>
/// <param name="entity"></param>
/// <param name="lstColumns"></param>
/// <param name="lstIgnoreColumns"></param>
/// <param name="strWhere"></param>
/// <returns></returns>
bool Update(T entity, List<string> lstColumns = null, List<string> lstIgnoreColumns = null, string strWhere = "");
/// <summary>
/// 查询所有信息
/// </summary>
/// <returns></returns>
List<T> Query();
/// <summary>
/// 根据Id查询实体
/// </summary>
/// <param name="objId"></param>
/// <returns></returns>
T Query(object objId);
/// <summary>
/// 根据表达式查询
/// </summary>
/// <param name="whereExpression"></param>
/// <returns></returns>
List<T> Query(Expression<Func<T, bool>> whereExpression);
/// <summary>
/// 根据表达式排序查询
/// </summary>
/// <param name="whereExpression">查询条件</param>
/// <param name="orderByExpression">排序条件</param>
/// <param name="isAsc">是否正序</param>
/// <returns></returns>
List<T> Query(Expression<Func<T, bool>> whereExpression, Expression<Func<T, object>> orderByExpression,
bool isAsc = true);
}
}

@ -10,7 +10,17 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sln.Wcs.HikRoBotSdk", "Sln.
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sln.Wcs.HikRoBotApi", "Sln.Wcs.HikRoBotApi\Sln.Wcs.HikRoBotApi.csproj", "{9E3193CA-590C-4965-B2EF-02C2AE252095}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sln.Wcs.Serilog", "Sln.Wcs.Serilog\Sln.Wcs.Serilog.csproj", "{DD340736-51E7-47D5-AF1E-24A79F8B4675}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sln.Wcs.Model", "Sln.Wcs.Model\Sln.Wcs.Model.csproj", "{18437437-F83E-4A3E-9759-8AF313C47D77}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sln.Wcs.Plc", "Sln.Wcs.Plc\Sln.Wcs.Plc.csproj", "{ECB2A29C-7A82-83D1-F9FD-5B8C41E55261}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sln.Wcs.ElevatorSdk", "SLn.Wcs.ElevatorSdk\Sln.Wcs.ElevatorSdk.csproj", "{504764BF-FD5F-4BE5-80C5-061C2EE9C79B}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sln.Wcs.Serilog", "Sln.Wcs.Serilog\Sln.Wcs.Serilog.csproj", "{5EF250AE-58B8-4C39-8F36-A579EA252A5C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sln.Wcs.Repository", "Sln.Wcs.Repository\Sln.Wcs.Repository.csproj", "{549AF273-88BE-4316-88F8-CAD82BC5F1E7}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sln.Wcs.Cache", "Sln.Wcs.Cache\Sln.Wcs.Cache.csproj", "{97940311-1DE9-4282-8EE0-0174513BF245}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -34,10 +44,30 @@ Global
{9E3193CA-590C-4965-B2EF-02C2AE252095}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9E3193CA-590C-4965-B2EF-02C2AE252095}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9E3193CA-590C-4965-B2EF-02C2AE252095}.Release|Any CPU.Build.0 = Release|Any CPU
{DD340736-51E7-47D5-AF1E-24A79F8B4675}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DD340736-51E7-47D5-AF1E-24A79F8B4675}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DD340736-51E7-47D5-AF1E-24A79F8B4675}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DD340736-51E7-47D5-AF1E-24A79F8B4675}.Release|Any CPU.Build.0 = Release|Any CPU
{18437437-F83E-4A3E-9759-8AF313C47D77}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{18437437-F83E-4A3E-9759-8AF313C47D77}.Debug|Any CPU.Build.0 = Debug|Any CPU
{18437437-F83E-4A3E-9759-8AF313C47D77}.Release|Any CPU.ActiveCfg = Release|Any CPU
{18437437-F83E-4A3E-9759-8AF313C47D77}.Release|Any CPU.Build.0 = Release|Any CPU
{ECB2A29C-7A82-83D1-F9FD-5B8C41E55261}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{ECB2A29C-7A82-83D1-F9FD-5B8C41E55261}.Debug|Any CPU.Build.0 = Debug|Any CPU
{ECB2A29C-7A82-83D1-F9FD-5B8C41E55261}.Release|Any CPU.ActiveCfg = Release|Any CPU
{ECB2A29C-7A82-83D1-F9FD-5B8C41E55261}.Release|Any CPU.Build.0 = Release|Any CPU
{504764BF-FD5F-4BE5-80C5-061C2EE9C79B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{504764BF-FD5F-4BE5-80C5-061C2EE9C79B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{504764BF-FD5F-4BE5-80C5-061C2EE9C79B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{504764BF-FD5F-4BE5-80C5-061C2EE9C79B}.Release|Any CPU.Build.0 = Release|Any CPU
{5EF250AE-58B8-4C39-8F36-A579EA252A5C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5EF250AE-58B8-4C39-8F36-A579EA252A5C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5EF250AE-58B8-4C39-8F36-A579EA252A5C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5EF250AE-58B8-4C39-8F36-A579EA252A5C}.Release|Any CPU.Build.0 = Release|Any CPU
{549AF273-88BE-4316-88F8-CAD82BC5F1E7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{549AF273-88BE-4316-88F8-CAD82BC5F1E7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{549AF273-88BE-4316-88F8-CAD82BC5F1E7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{549AF273-88BE-4316-88F8-CAD82BC5F1E7}.Release|Any CPU.Build.0 = Release|Any CPU
{97940311-1DE9-4282-8EE0-0174513BF245}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{97940311-1DE9-4282-8EE0-0174513BF245}.Debug|Any CPU.Build.0 = Debug|Any CPU
{97940311-1DE9-4282-8EE0-0174513BF245}.Release|Any CPU.ActiveCfg = Release|Any CPU
{97940311-1DE9-4282-8EE0-0174513BF245}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

@ -1,9 +1,16 @@
using System.Reflection;
using Com.Ctrip.Framework.Apollo;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection;
using NeoSmart.Caching.Sqlite;
using Newtonsoft.Json;
using Sln.Wcs.HikRoBotSdk;
using Sln.Wcs.Model.Configs;
using Sln.Wcs.Repository;
using Sln.Wcs.Repository.service;
using Sln.Wcs.Serilog;
using ZiggyCreatures.Caching.Fusion;
using ZiggyCreatures.Caching.Fusion.Serialization.NewtonsoftJson;
namespace Sln.Wcs
{
@ -12,7 +19,7 @@ namespace Sln.Wcs
static async Task Main(string[] args)
{
var services = new ServiceCollection();
var services = new ServiceCollection();
ConfigureServices(services);
@ -21,16 +28,55 @@ namespace Sln.Wcs
serviceProvider.UseSerilogExtensions();
var config = serviceProvider.GetService<IConfiguration>();
var log = serviceProvider.GetService<SerilogHelper>();
log.Info($"系统启动成功,日志存放位置:{config["logPath"]}");
log.Info($"系统启动成功,日志存放位置:{config["logPath"]}");
}
private static void ConfigureServices(IServiceCollection services)
{
#region Apollo配置
var basePath = AppContext.BaseDirectory;
ApolloConfigureServices(services,ref basePath,out IConfiguration apolloConfiguration);
Assembly[] assemblies = {
Assembly.LoadFrom(Path.Combine(basePath, "Sln.Wcs.Common.dll")),
Assembly.LoadFrom(Path.Combine(basePath, "Sln.Wcs.Cache.dll")),
Assembly.LoadFrom(Path.Combine(basePath, "Sln.Wcs.Repository.dll")),
Assembly.LoadFrom(Path.Combine(basePath, "Sln.Wcs.HikRoBotApi.dll")),
Assembly.LoadFrom(Path.Combine(basePath, "Sln.Wcs.HikRoBotSdk.dll")),
};
services.Scan(scan => scan.FromAssemblies(assemblies)
.AddClasses()
.AsImplementedInterfaces()
.AsSelf()
.WithTransientLifetime());
services.AddSingleton(typeof(SerilogHelper));
services.AddSqlSugarSetup();
services.AddFusionCache()
.WithSerializer(
new FusionCacheNewtonsoftJsonSerializer()
)
.WithDistributedCache(new SqliteCache(new SqliteCacheOptions
{
CachePath = apolloConfiguration["cachePath"]
}));
}
/// <summary>
/// Apollo 配置中心
/// </summary>
/// <param name="services"></param>
/// <param name="basePath"></param>
/// <param name="apolloConfiguration"></param>
private static void ApolloConfigureServices(IServiceCollection services, ref string basePath, out IConfiguration apolloConfiguration)
{
var localConfiguration = new ConfigurationBuilder()
.SetBasePath(basePath)
.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
@ -46,25 +92,10 @@ namespace Sln.Wcs
.AddApollo(apolloConfigSection)
.AddDefault();
var apolloConfiguration = configurationBuilder.Build();
apolloConfiguration = configurationBuilder.Build();
services.Remove(new ServiceDescriptor(typeof(IConfiguration), localConfiguration));
services.AddSingleton<IConfiguration>(apolloConfiguration);
#endregion
Assembly[] assemblies = {
Assembly.LoadFrom(Path.Combine(basePath, "Sln.Wcs.Common.dll")),
Assembly.LoadFrom(Path.Combine(basePath, "Sln.Wcs.HikRoBotApi.dll")),
Assembly.LoadFrom(Path.Combine(basePath, "Sln.Wcs.HikRoBotSdk.dll")),
};
services.Scan(scan => scan.FromAssemblies(assemblies)
.AddClasses()
.AsImplementedInterfaces()
.AsSelf()
.WithTransientLifetime());
services.AddSingleton(typeof(SerilogHelper));
}
}

@ -26,8 +26,10 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Sln.Wcs.Cache\Sln.Wcs.Cache.csproj" />
<ProjectReference Include="..\Sln.Wcs.HikRoBotApi\Sln.Wcs.HikRoBotApi.csproj" />
<ProjectReference Include="..\Sln.Wcs.HikRoBotSdk\Sln.Wcs.HikRoBotSdk.csproj" />
<ProjectReference Include="..\Sln.Wcs.Repository\Sln.Wcs.Repository.csproj" />
<ProjectReference Include="..\Sln.Wcs.Serilog\Sln.Wcs.Serilog.csproj" />
</ItemGroup>

Loading…
Cancel
Save