bug处理,二楼空载具料架入库
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
<Nullable>enable</Nullable>
|
||||
<GenerateDocumentationFile>False</GenerateDocumentationFile>
|
||||
<Configurations>Debug;Release;tianyi</Configurations>
|
||||
<ServerGarbageCollection>false</ServerGarbageCollection>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
<Nullable>enable</Nullable>
|
||||
<GenerateDocumentationFile>False</GenerateDocumentationFile>
|
||||
<Configurations>Debug;Release;tianyi</Configurations>
|
||||
<ServerGarbageCollection>false</ServerGarbageCollection>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
<Nullable>enable</Nullable>
|
||||
<GenerateDocumentationFile>True</GenerateDocumentationFile>
|
||||
<Configurations>Debug;Release;tianyi</Configurations>
|
||||
<ServerGarbageCollection>false</ServerGarbageCollection>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<Configurations>Debug;Release;tianyi</Configurations>
|
||||
<ServerGarbageCollection>false</ServerGarbageCollection>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<Configurations>Debug;Release;tianyi</Configurations>
|
||||
<ServerGarbageCollection>false</ServerGarbageCollection>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
<Nullable>enable</Nullable>
|
||||
<GenerateDocumentationFile>True</GenerateDocumentationFile>
|
||||
<Configurations>Debug;Release;tianyi</Configurations>
|
||||
<ServerGarbageCollection>false</ServerGarbageCollection>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<Configurations>Debug;Release;tianyi</Configurations>
|
||||
<ServerGarbageCollection>false</ServerGarbageCollection>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<Configurations>Debug;Release;tianyi</Configurations>
|
||||
<ServerGarbageCollection>false</ServerGarbageCollection>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<Configurations>Debug;Release;tianyi</Configurations>
|
||||
<ServerGarbageCollection>false</ServerGarbageCollection>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
<Nullable>enable</Nullable>
|
||||
<GenerateDocumentationFile>False</GenerateDocumentationFile>
|
||||
<Configurations>Debug;Release;tianyi</Configurations>
|
||||
<ServerGarbageCollection>false</ServerGarbageCollection>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
<Nullable>enable</Nullable>
|
||||
<GenerateDocumentationFile>False</GenerateDocumentationFile>
|
||||
<Configurations>Debug;Release;tianyi</Configurations>
|
||||
<ServerGarbageCollection>false</ServerGarbageCollection>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -6,6 +6,7 @@
|
||||
<Nullable>enable</Nullable>
|
||||
<GenerateDocumentationFile>True</GenerateDocumentationFile>
|
||||
<Configurations>Debug;Release;tianyi</Configurations>
|
||||
<ServerGarbageCollection>false</ServerGarbageCollection>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<Configurations>Debug;Release;tianyi</Configurations>
|
||||
<ServerGarbageCollection>false</ServerGarbageCollection>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<Configurations>Debug;Release;tianyi</Configurations>
|
||||
<ServerGarbageCollection>false</ServerGarbageCollection>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<Configurations>Debug;Release;tianyi</Configurations>
|
||||
<ServerGarbageCollection>false</ServerGarbageCollection>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -39,6 +39,10 @@
|
||||
/// 预任务生成EnCode
|
||||
/// </summary>
|
||||
public const string WMS_PRETASK_H_ENCODE = "PreTaskGen";
|
||||
/// <summary>
|
||||
/// 采购收料物料流水号
|
||||
/// </summary>
|
||||
public const string WMS_PURCHASE_MAT_ENCODE = "PurchaseMat";
|
||||
/// 齐套出库生成Encode
|
||||
/// </summary>
|
||||
public const string WMS_KITTINGOUTSTK_ENCODE = "WmsKittingOutStk";
|
||||
@@ -325,15 +329,19 @@
|
||||
/// <summary>
|
||||
/// 一楼供料三工位库位
|
||||
/// </summary>
|
||||
public const string Floor1GLSGWOutstockStation1 = "30773146852476";
|
||||
public const string Floor1GLSGWOutstockStation1 = "30773146852478";
|
||||
/// <summary>
|
||||
/// 一楼供料三工位库位
|
||||
/// </summary>
|
||||
public const string Floor1GLSGWOutstockStation2 = "30773146852477";
|
||||
public const string Floor1GLSGWOutstockStation2 = "30773146852479";
|
||||
/// <summary>
|
||||
/// 一楼供料三工位库位
|
||||
/// </summary>
|
||||
public const string Floor1GLSGWOutstockStation3 = "30773146852478";
|
||||
public const string Floor1GLSGWOutstockStation3 = "30773146852480";
|
||||
/// <summary>
|
||||
/// 一楼供料三工位库位
|
||||
/// </summary>
|
||||
public const string Floor1GLSGWOutstockStation4 = "30773146852480";
|
||||
/// <summary>
|
||||
/// todo 一楼外协三工位库位
|
||||
/// </summary>
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
namespace Tnb.WarehouseMgr.Entities.Dto
|
||||
{
|
||||
/// <summary>
|
||||
/// 库房业务更新输入参数
|
||||
/// </summary>
|
||||
public class MaterialTransferRackInstockInput
|
||||
{
|
||||
/// <summary>
|
||||
/// 组织ID
|
||||
/// </summary>
|
||||
public string org_id { get; set; }
|
||||
/// <summary>
|
||||
/// 创建用户
|
||||
/// </summary>
|
||||
public string create_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 料架号
|
||||
/// </summary>
|
||||
public string? carry_code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 空料箱
|
||||
/// </summary>
|
||||
public List<MaterialTransferRackInstockDetail> details { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 起始库位
|
||||
/// </summary>
|
||||
public string? startlocation_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 判断料箱是否为空
|
||||
/// </summary>
|
||||
public bool judgeEmptyCarry { get; set; } = true;
|
||||
}
|
||||
|
||||
|
||||
public class MaterialTransferRackInstockDetail
|
||||
{
|
||||
/// <summary>
|
||||
/// 料箱号
|
||||
/// </summary>
|
||||
public string? carry_code { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,7 @@
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<Configurations>Debug;Release;tianyi</Configurations>
|
||||
<ServerGarbageCollection>false</ServerGarbageCollection>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<Configurations>Debug;Release;tianyi</Configurations>
|
||||
<ServerGarbageCollection>false</ServerGarbageCollection>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace Tnb.WarehouseMgr
|
||||
private readonly ElevatorControlConfiguration _elevatorControlConfiguration = App.Configuration.Build<ElevatorControlConfiguration>();
|
||||
private readonly IServiceProvider _serviceProvider;
|
||||
private readonly IHostApplicationLifetime _lifeTime;
|
||||
private static List<string> s_heartbeatDevNames = new();
|
||||
private List<string> s_heartbeatDevNames = new();
|
||||
//private static Dictionary<string, Func<CancellationToken?, Task>> _timedFuncMap = new(StringComparer.OrdinalIgnoreCase);
|
||||
public TimedTaskBackgroundService()
|
||||
{
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
<Nullable>enable</Nullable>
|
||||
<GenerateDocumentationFile>True</GenerateDocumentationFile>
|
||||
<Configurations>Debug;Release</Configurations>
|
||||
<ServerGarbageCollection>false</ServerGarbageCollection>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -247,8 +247,8 @@ namespace Tnb.WarehouseMgr
|
||||
/// <returns></returns>
|
||||
public string[] GetFloor1GLSGWOutstockLocation()
|
||||
{
|
||||
return new string[3] { WmsWareHouseConst.Floor1GLSGWOutstockStation1 , WmsWareHouseConst.Floor1GLSGWOutstockStation2
|
||||
, WmsWareHouseConst.Floor1GLSGWOutstockStation3 };
|
||||
return new string[4] { WmsWareHouseConst.Floor1GLSGWOutstockStation1 , WmsWareHouseConst.Floor1GLSGWOutstockStation2
|
||||
, WmsWareHouseConst.Floor1GLSGWOutstockStation3, WmsWareHouseConst.Floor1GLSGWOutstockStation4 };
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -786,7 +786,10 @@ namespace Tnb.WarehouseMgr
|
||||
third_eqp_type = c.third_eqp_type,
|
||||
}, true);
|
||||
|
||||
Logger.Information("【GenTaskExecute】 执行SQL: " + sugarQueryable.ToSqlString());
|
||||
if (sugarQueryable.Count() == 0)
|
||||
return;
|
||||
|
||||
//Logger.Information("【GenTaskExecute】 执行SQL: " + sugarQueryable.ToSqlString());
|
||||
|
||||
List<WmsPretaskH> preTasks = await sugarQueryable.ToListAsync();
|
||||
|
||||
@@ -1105,9 +1108,13 @@ namespace Tnb.WarehouseMgr
|
||||
move_num = b.move_num,
|
||||
third_eqp_type = b.third_eqp_type,
|
||||
}, true).ToListAsync();
|
||||
|
||||
if (CTUTasks.Count == 0)
|
||||
return;
|
||||
|
||||
List<WmsPretaskCode> TaskCodes = await db.Queryable<WmsPretaskCode>().Where(it => CTUTasks.Select(p => p.id).ToList().Contains(it.bill_id)).ToListAsync();
|
||||
|
||||
Logger.Information($@"【CTUTaskExecute】 获取任务TaskCodes: {JsonConvert.SerializeObject(TaskCodes)}");
|
||||
//Logger.Information($@"【CTUTaskExecute】 获取任务TaskCodes: {JsonConvert.SerializeObject(TaskCodes)}");
|
||||
|
||||
var InTasks = CTUTasks.Where(a => a.task_type == WmsWareHouseConst.WMS_PRETASK_INSTOCK_TYPE_ID).ToList();
|
||||
var OutTasks = CTUTasks.Where(a => a.task_type == WmsWareHouseConst.WMS_PRETASK_OUTSTOCK_TYPE_ID || a.task_type == WmsWareHouseConst.BIZTYPE_WMSTRANSFER_ID).ToList();
|
||||
|
||||
@@ -11,6 +11,7 @@ using JNPF.VisualDev.Entitys;
|
||||
using JNPF.VisualDev.Interfaces;
|
||||
using Mapster;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Newtonsoft.Json;
|
||||
using Senparc.Weixin.MP.AdvancedAPIs.Card;
|
||||
using SqlSugar;
|
||||
@@ -166,8 +167,10 @@ namespace Tnb.WarehouseMgr
|
||||
if (WmsCarryCodes.Count > 0)
|
||||
await _db.Insertable(WmsCarryCodes).ExecuteCommandAsync();
|
||||
}
|
||||
catch (Exception)
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.LogError(ex.Message);
|
||||
Logger.LogError(ex.StackTrace);
|
||||
throw new AppFriendlyException("绑定失败", 500);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -553,7 +553,7 @@ namespace Tnb.WarehouseMgr
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 从暂存仓呼叫料架到产线
|
||||
/// 通过工位查找料架信息
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
@@ -621,5 +621,77 @@ namespace Tnb.WarehouseMgr
|
||||
return await ToApiResult(HttpStatusCode.InternalServerError, ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 从产线呼叫装料架到暂存仓
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost, NonUnify, AllowAnonymous]
|
||||
public async Task<Tnb.WarehouseMgr.Entities.Dto.Outputs.Result> RackInstock(MaterialTransferRackInstockInput input)
|
||||
{
|
||||
try
|
||||
{
|
||||
BasLocation startlocation = _db.Queryable<BasLocation>().Where(r => r.id == input.startlocation_id).First();
|
||||
if (startlocation == null)
|
||||
{
|
||||
Logger.LogWarning($"【RackEmptyInstock】不存在id为{input.startlocation_id}的库位!");
|
||||
throw new AppFriendlyException($"【RackEmptyInstock】不存在id为{input.startlocation_id}的库位!", 500);
|
||||
}
|
||||
if (string.IsNullOrEmpty(input.carry_code))
|
||||
{
|
||||
Logger.LogWarning($"【RackEmptyInstock】料架不能为空!{input.carry_code}");
|
||||
throw new AppFriendlyException($"【RackEmptyInstock】料架不能为空!{input.carry_code}!", 500);
|
||||
}
|
||||
if (input.judgeEmptyCarry)
|
||||
{
|
||||
List<WmsCarryCode> wmsCarryCodes = _db.Queryable<WmsCarryH>()
|
||||
.InnerJoin<WmsCarryCode>((a, b) => a.id == b.carry_id)
|
||||
.Where((a, b) => input.details.Select(r => r.carry_code).Contains(a.carry_code)).Select((a, b) => b).ToList();
|
||||
if (wmsCarryCodes.Count > 0)
|
||||
{
|
||||
Logger.LogWarning($"【RackEmptyInstock】存在非空料箱{string.Join(',', wmsCarryCodes.Select(r => r.carry_code).Distinct())},不能入库!{input.carry_code}");
|
||||
throw new AppFriendlyException($"【RackEmptyInstock】存在非空料箱{string.Join(',', wmsCarryCodes.Select(r => r.carry_code).Distinct())},不能入库!{input.carry_code}!", 500);
|
||||
}
|
||||
}
|
||||
|
||||
// 找到未占用且未锁定的库位
|
||||
ISugarQueryable<BasLocation> rackEndLocations =
|
||||
_db.Queryable<BasLocation>()
|
||||
.Where(r => r.wh_id == "33780009364245" && r.is_use == "0" && r.is_lock == 0).OrderBy(a => a.id).Take(1);
|
||||
|
||||
if (rackEndLocations.Count() == 0)
|
||||
{
|
||||
Logger.LogWarning($"【RackEmptyInstock】没有可用的终点库位");
|
||||
throw new AppFriendlyException($"【RackEmptyInstock】没有可用的终点库位!", 500);
|
||||
}
|
||||
|
||||
BasLocation endlocation = rackEndLocations.First();
|
||||
|
||||
|
||||
CommonCreatePretaskInput commonCreatePretaskInput = new CommonCreatePretaskInput();
|
||||
commonCreatePretaskInput.startlocation_id = startlocation.id;
|
||||
commonCreatePretaskInput.endlocation_id = endlocation.id;
|
||||
commonCreatePretaskInput.carry_code = input.carry_code;
|
||||
commonCreatePretaskInput.task_type = "";
|
||||
commonCreatePretaskInput.biz_type = "FloorCallMaterial";
|
||||
|
||||
var res = await _wareHouseService.CommonCreatePretask(commonCreatePretaskInput);
|
||||
if (res.code != JNPF.Common.Enums.HttpStatusCode.OK)
|
||||
{
|
||||
Logger.LogInformation($"【RackEmptyInstock】生成预任务失败 载具 {input.carry_code}");
|
||||
throw new AppFriendlyException($"生成预任务失败 载具 {input.carry_code}", 500);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.LogError("【RackEmptyInstock】" + ex.Message);
|
||||
Logger.LogError("【RackEmptyInstock】" + ex.StackTrace);
|
||||
return await ToApiResult(HttpStatusCode.InternalServerError, ex.Message);
|
||||
}
|
||||
|
||||
return await ToApiResult(HttpStatusCode.OK, "成功");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,11 +41,12 @@ namespace Tnb.WarehouseMgr
|
||||
private readonly IBillRullService _billRullService;
|
||||
private readonly ISqlSugarClient _db;
|
||||
private readonly IUserManager _userManager;
|
||||
public WmsPurchaseService(ISqlSugarRepository<WmsPurchaseH> repo, IUserManager userManager, IQcCheckPlanService qcCheckPlanService)
|
||||
public WmsPurchaseService(ISqlSugarRepository<WmsPurchaseH> repo, IUserManager userManager, IQcCheckPlanService qcCheckPlanService, IBillRullService billRullService)
|
||||
: base(repo, userManager, qcCheckPlanService)
|
||||
{
|
||||
_db = repo.AsSugarClient();
|
||||
_userManager = userManager;
|
||||
_billRullService = billRullService;
|
||||
}
|
||||
|
||||
private async Task<dynamic> xxx(VisualDevModelDataCrInput input)
|
||||
@@ -179,7 +180,11 @@ namespace Tnb.WarehouseMgr
|
||||
for (int j = 0; j < codeNum; j++)
|
||||
{
|
||||
int index = j + 1;
|
||||
string code = $"{WmsPurchaseD.material_code}-{WmsPurchaseD.code_batch}-{index.ToString().PadLeft(4, '0')}";
|
||||
//string code = $"{WmsPurchaseD.material_code}-{WmsPurchaseD.code_batch}-{index.ToString().PadLeft(4, '0')}";
|
||||
// 变更加流水号
|
||||
string watercode = await _billRullService.GetBillNumber(WmsWareHouseConst.WMS_PURCHASE_MAT_ENCODE); ;
|
||||
|
||||
string code = $"{WmsPurchaseD.material_code}-{WmsPurchaseD.code_batch}{watercode}";
|
||||
WmsTempCode barCode = new()
|
||||
{
|
||||
material_id = WmsPurchaseD.material_id,
|
||||
|
||||
@@ -50,6 +50,7 @@ public class Startup : AppStartup
|
||||
services.AddMemoryCache(); // 使用本地缓存必须添加
|
||||
services.AddConfigurableOptions<CacheOptions>();
|
||||
services.AddSingleton(typeof(ISingleton), typeof(RedisData));
|
||||
services.AddSingleton(typeof(ISingleton), typeof(StackExRedisHelper));
|
||||
// 微信
|
||||
services.AddSenparcGlobalServices(App.Configuration) // Senparc.CO2NET 全局注册
|
||||
.AddSenparcWeixinServices(App.Configuration); // Senparc.Weixin 注册(如果使用Senparc.Weixin SDK则添加)
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<SatelliteResourceLanguages>none</SatelliteResourceLanguages>
|
||||
<ServerGarbageCollection>false</ServerGarbageCollection>
|
||||
<ConcurrentGarbageCollection>true</ConcurrentGarbageCollection>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
<GenerateDocumentationFile>False</GenerateDocumentationFile>
|
||||
<NoWarn>$(NoWarn);CS8618;</NoWarn>
|
||||
<Configurations>Debug;Release;tianyi</Configurations>
|
||||
<ServerGarbageCollection>false</ServerGarbageCollection>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
<Nullable>enable</Nullable>
|
||||
<GenerateDocumentationFile>False</GenerateDocumentationFile>
|
||||
<Configurations>Debug;Release;tianyi</Configurations>
|
||||
<ServerGarbageCollection>false</ServerGarbageCollection>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
<GenerateDocumentationFile>True</GenerateDocumentationFile>
|
||||
<NoWarn>$(NoWarn);CS8600;CS8601;CS8602;CS8603;CS8604;CS8625;CS1572;CS1573;</NoWarn>
|
||||
<Configurations>Debug;Release;tianyi</Configurations>
|
||||
<ServerGarbageCollection>false</ServerGarbageCollection>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
<GenerateDocumentationFile>False</GenerateDocumentationFile>
|
||||
<NoWarn>$(NoWarn);CS8600;CS8601;CS8602;CS8603;CS8604;CS8618;CS8625;CS1572;CS1573;CS0168;</NoWarn>
|
||||
<Configurations>Debug;Release;tianyi</Configurations>
|
||||
<ServerGarbageCollection>false</ServerGarbageCollection>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
<GenerateDocumentationFile>False</GenerateDocumentationFile>
|
||||
<NoWarn>$(NoWarn);CS8600;CS8601;CS8602;CS8603;CS8604;CS8618;CS8625;CS1572;CS1573;CS0168;CS1998;</NoWarn>
|
||||
<Configurations>Debug;Release;tianyi</Configurations>
|
||||
<ServerGarbageCollection>false</ServerGarbageCollection>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace Tnb.Common.Redis
|
||||
{
|
||||
public class RedisData : ISingleton
|
||||
{
|
||||
private static CSRedisClient _instance;
|
||||
private CSRedisClient _instance;
|
||||
public delegate void rcvMsgHandler(string Channel, string Body);
|
||||
public event rcvMsgHandler rcvMsg;
|
||||
public RedisData()
|
||||
@@ -25,14 +25,14 @@ namespace Tnb.Common.Redis
|
||||
RedisOptions _RedisOptions = App.GetConfig<RedisOptions>("Redis", true);
|
||||
_instance = new CSRedis.CSRedisClient(string.Format(_RedisOptions.RedisConnectionString, _RedisOptions.ip, _RedisOptions.port, _RedisOptions.password));
|
||||
|
||||
_instance.Subscribe(("devdata_change", msg =>
|
||||
{
|
||||
if (rcvMsg != null)
|
||||
{
|
||||
rcvMsg(msg.Channel, msg.Body);
|
||||
}
|
||||
}
|
||||
));
|
||||
//_instance.Subscribe(("devdata_change", msg =>
|
||||
//{
|
||||
// if (rcvMsg != null)
|
||||
// {
|
||||
// rcvMsg(msg.Channel, msg.Body);
|
||||
// }
|
||||
//}
|
||||
//));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
88
common/Tnb.Common/Redis/StackExRedisHelper.cs
Normal file
88
common/Tnb.Common/Redis/StackExRedisHelper.cs
Normal file
@@ -0,0 +1,88 @@
|
||||
|
||||
using JNPF;
|
||||
using JNPF.DependencyInjection;
|
||||
using Newtonsoft.Json;
|
||||
using Spire.Xls.Core;
|
||||
using StackExchange.Redis;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Tnb.Common.Redis
|
||||
{
|
||||
public class StackExRedisHelper : ISingleton
|
||||
{
|
||||
private ConnectionMultiplexer _redis;
|
||||
private IDatabase _db;
|
||||
|
||||
// 初始化 Redis 连接
|
||||
public StackExRedisHelper()
|
||||
{
|
||||
RedisOptions _RedisOptions = App.GetConfig<RedisOptions>("Redis", true);
|
||||
_redis = ConnectionMultiplexer.Connect($"{_RedisOptions.ip}:{_RedisOptions.port},password={_RedisOptions.password}");
|
||||
_db = _redis.GetDatabase();
|
||||
}
|
||||
|
||||
// 存储字符串值
|
||||
public void SetString(string key, string value)
|
||||
{
|
||||
_db.StringSet(key, value);
|
||||
}
|
||||
|
||||
// 获取字符串值
|
||||
public string GetString(string key)
|
||||
{
|
||||
return _db.StringGet(key);
|
||||
}
|
||||
|
||||
// 存储哈希值
|
||||
public void SetHash(string key, string field, string value)
|
||||
{
|
||||
_db.HashSet(key, field, value);
|
||||
}
|
||||
|
||||
// 获取哈希值
|
||||
public string GetHash(string key, string field)
|
||||
{
|
||||
return _db.HashGet(key, field);
|
||||
}
|
||||
|
||||
// 存储列表值
|
||||
public void ListRightPush(string key, string value)
|
||||
{
|
||||
_db.ListRightPush(key, value);
|
||||
}
|
||||
|
||||
// 关闭 Redis 连接
|
||||
public void Close()
|
||||
{
|
||||
if (_redis != null && _redis.IsConnected)
|
||||
{
|
||||
_redis.Close();
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<T> TryGetValueByKeyField<T>(string key, string field)
|
||||
{
|
||||
if (_db.HashExists(key, field))
|
||||
{
|
||||
string data = GetHash(key, field);
|
||||
Dictionary<String, String> json = JsonConvert.DeserializeObject<Dictionary<String, String>>(data);
|
||||
Type type = typeof(T);
|
||||
if ((!type.IsValueType && type.GetGenericArguments().Length > 0) || (type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>)))
|
||||
{
|
||||
return (T)Convert.ChangeType(json["Value"], type.GetGenericArguments()[0]);
|
||||
}
|
||||
else
|
||||
{
|
||||
return (T)Convert.ChangeType(json["Value"], type);
|
||||
}
|
||||
// return ;
|
||||
}
|
||||
return default(T);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
<GenerateDocumentationFile>False</GenerateDocumentationFile>
|
||||
<NoWarn>$(NoWarn);CS8600;CS8601;CS8602;CS8603;CS8604;CS8605;CS8618;CS8619;CS8625;CS1572;CS1573;</NoWarn>
|
||||
<Configurations>Debug;Release;tianyi</Configurations>
|
||||
<ServerGarbageCollection>false</ServerGarbageCollection>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
@@ -17,6 +18,7 @@
|
||||
<PackageReference Include="CSRedisCore" Version="3.8.3" />
|
||||
<PackageReference Include="FreeSpire.Office" Version="4.3.1" />
|
||||
<PackageReference Include="NPOI" Version="2.5.5" />
|
||||
<PackageReference Include="StackExchange.Redis" Version="2.7.33" />
|
||||
<PackageReference Include="System.Diagnostics.PerformanceCounter" Version="6.0.0" />
|
||||
<PackageReference Include="System.Management" Version="6.0.0" />
|
||||
<PackageReference Include="UAParser" Version="3.1.47" />
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
<NoWarn>$(NoWarn);CS1591;</NoWarn>
|
||||
<GenerateDocumentationFile>False</GenerateDocumentationFile>
|
||||
<Configurations>Debug;Release;tianyi</Configurations>
|
||||
<ServerGarbageCollection>false</ServerGarbageCollection>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
1
common/Tnb.Thirdparty/Tnb.Thirdparty.csproj
vendored
1
common/Tnb.Thirdparty/Tnb.Thirdparty.csproj
vendored
@@ -8,6 +8,7 @@
|
||||
<GenerateDocumentationFile>False</GenerateDocumentationFile>
|
||||
<NoWarn>$(NoWarn);CS8600;CS8601;CS8602;CS8603;CS8604;CS8618;CS8625;CS1572;CS1573;CS0168;CS0618;</NoWarn>
|
||||
<Configurations>Debug;Release;tianyi</Configurations>
|
||||
<ServerGarbageCollection>false</ServerGarbageCollection>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
<GenerateDocumentationFile>False</GenerateDocumentationFile>
|
||||
<NoWarn>$(NoWarn);CS8600;CS8601;CS8602;CS8603;CS8604;CS8618;CS1572;CS1573;CS1998;</NoWarn>
|
||||
<Configurations>Debug;Release;tianyi</Configurations>
|
||||
<ServerGarbageCollection>false</ServerGarbageCollection>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
<GenerateDocumentationFile>False</GenerateDocumentationFile>
|
||||
<NoWarn>$(NoWarn);CS8618;</NoWarn>
|
||||
<Configurations>Debug;Release;tianyi</Configurations>
|
||||
<ServerGarbageCollection>false</ServerGarbageCollection>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
<GenerateDocumentationFile>False</GenerateDocumentationFile>
|
||||
<NoWarn>$(NoWarn);CS8625;</NoWarn>
|
||||
<Configurations>Debug;Release;tianyi</Configurations>
|
||||
<ServerGarbageCollection>false</ServerGarbageCollection>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
<GenerateDocumentationFile>True</GenerateDocumentationFile>
|
||||
<NoWarn>$(NoWarn);CS8600;CS8601;CS8602;CS8603;CS8604;CS8625;CS1572;CS1573;CS0168;</NoWarn>
|
||||
<Configurations>Debug;Release;tianyi</Configurations>
|
||||
<ServerGarbageCollection>false</ServerGarbageCollection>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
<GenerateDocumentationFile>True</GenerateDocumentationFile>
|
||||
<NoWarn>$(NoWarn);CS8600;CS8601;CS8602;CS8603;CS8604;CS8618;CS8625;CS1572;CS1573;</NoWarn>
|
||||
<Configurations>Debug;Release;tianyi</Configurations>
|
||||
<ServerGarbageCollection>false</ServerGarbageCollection>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
<GenerateDocumentationFile>False</GenerateDocumentationFile>
|
||||
<NoWarn>$(NoWarn);CS8603;CS8618;</NoWarn>
|
||||
<Configurations>Debug;Release;tianyi</Configurations>
|
||||
<ServerGarbageCollection>false</ServerGarbageCollection>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
<GenerateDocumentationFile>False</GenerateDocumentationFile>
|
||||
<NoWarn>$(NoWarn);CS8625;</NoWarn>
|
||||
<Configurations>Debug;Release;tianyi</Configurations>
|
||||
<ServerGarbageCollection>false</ServerGarbageCollection>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
<GenerateDocumentationFile>True</GenerateDocumentationFile>
|
||||
<NoWarn>$(NoWarn);CS8600;CS8601;CS8602;CS8603;CS8604;CS8619;CS8625;CS8629;CS1572;CS1573;CS0168;CS4014;CS1998;</NoWarn>
|
||||
<Configurations>Debug;Release;tianyi</Configurations>
|
||||
<ServerGarbageCollection>false</ServerGarbageCollection>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
<GenerateDocumentationFile>False</GenerateDocumentationFile>
|
||||
<NoWarn>$(NoWarn)CS8604;CS8618;</NoWarn>
|
||||
<Configurations>Debug;Release;tianyi</Configurations>
|
||||
<ServerGarbageCollection>false</ServerGarbageCollection>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
<Nullable>enable</Nullable>
|
||||
<GenerateDocumentationFile>False</GenerateDocumentationFile>
|
||||
<Configurations>Debug;Release;tianyi</Configurations>
|
||||
<ServerGarbageCollection>false</ServerGarbageCollection>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
<GenerateDocumentationFile>True</GenerateDocumentationFile>
|
||||
<NoWarn>$(NoWarn);CS8600;CS8601;CS8602;CS8603;CS8604;CS8625;CS1572;CS1573;</NoWarn>
|
||||
<Configurations>Debug;Release;tianyi</Configurations>
|
||||
<ServerGarbageCollection>false</ServerGarbageCollection>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<Configurations>Debug;Release;tianyi</Configurations>
|
||||
<ServerGarbageCollection>false</ServerGarbageCollection>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
<GenerateDocumentationFile>False</GenerateDocumentationFile>
|
||||
<NoWarn>$(NoWarn);CS8600;CS8601;CS8602;CS8603;CS8604;CS8618;CS8625;CS8629;CS1572;CS1573;CS0168;</NoWarn>
|
||||
<Configurations>Debug;Release;tianyi</Configurations>
|
||||
<ServerGarbageCollection>false</ServerGarbageCollection>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
<GenerateDocumentationFile>False</GenerateDocumentationFile>
|
||||
<NoWarn>$(NoWarn);CS8618;</NoWarn>
|
||||
<Configurations>Debug;Release;tianyi</Configurations>
|
||||
<ServerGarbageCollection>false</ServerGarbageCollection>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
<Nullable>enable</Nullable>
|
||||
<GenerateDocumentationFile>False</GenerateDocumentationFile>
|
||||
<Configurations>Debug;Release;tianyi</Configurations>
|
||||
<ServerGarbageCollection>false</ServerGarbageCollection>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
<GenerateDocumentationFile>True</GenerateDocumentationFile>
|
||||
<NoWarn>$(NoWarn);CS8600;CS8601;CS8602;CS8603;CS8604;CS8625;CS8629;CS1572;CS1573;CS0168;</NoWarn>
|
||||
<Configurations>Debug;Release;tianyi</Configurations>
|
||||
<ServerGarbageCollection>false</ServerGarbageCollection>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
<GenerateDocumentationFile>False</GenerateDocumentationFile>
|
||||
<NoWarn>$(NoWarn);CS8618;</NoWarn>
|
||||
<Configurations>Debug;Release;tianyi</Configurations>
|
||||
<ServerGarbageCollection>false</ServerGarbageCollection>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
<GenerateDocumentationFile>False</GenerateDocumentationFile>
|
||||
<NoWarn>$(NoWarn);CS8625;</NoWarn>
|
||||
<Configurations>Debug;Release;tianyi</Configurations>
|
||||
<ServerGarbageCollection>false</ServerGarbageCollection>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
<GenerateDocumentationFile>True</GenerateDocumentationFile>
|
||||
<NoWarn>$(NoWarn);CS8600;CS8601;CS8602;CS8603;CS8604;CS8619;CS8620;CS8625;CS8629;CS1572;CS1573;CS0168;CS4014;CS1998;</NoWarn>
|
||||
<Configurations>Debug;Release;tianyi</Configurations>
|
||||
<ServerGarbageCollection>false</ServerGarbageCollection>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
Reference in New Issue
Block a user