wms接入redis
This commit is contained in:
@@ -12,12 +12,15 @@ using JNPF.FriendlyException;
|
||||
using JNPF.Systems.Interfaces.System;
|
||||
using Mapster;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.Rendering;
|
||||
using Microsoft.CodeAnalysis;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using NPOI.OpenXmlFormats.Dml;
|
||||
using SqlSugar;
|
||||
using Tnb.BasicData.Entities;
|
||||
using Tnb.Common.Extension;
|
||||
using Tnb.Common.Redis;
|
||||
using Tnb.Common.Utils;
|
||||
using Tnb.WarehouseMgr.Entities;
|
||||
using Tnb.WarehouseMgr.Entities.Configs;
|
||||
@@ -45,8 +48,8 @@ namespace Tnb.WarehouseMgr
|
||||
private readonly ElevatorControlConfiguration _eleCtlCfg = App.Configuration.Build<ElevatorControlConfiguration>();
|
||||
private static Dictionary<string, object> locMap = new Dictionary<string, object>(StringComparer.OrdinalIgnoreCase);
|
||||
public Func<string, int, Task> AddUnExecuteTask { get; set; }
|
||||
|
||||
public WareHouseService(ISqlSugarRepository<WmsInstockH> repository, IDictionaryDataService dictionaryDataService,
|
||||
private readonly RedisData _redisData;
|
||||
public WareHouseService(ISqlSugarRepository<WmsInstockH> repository, IDictionaryDataService dictionaryDataService, RedisData redisData,
|
||||
IBillRullService billRullService, IUserManager userManager, ICacheManager cacheManager, IElevatorControlService elevatorControlService)
|
||||
//: base(repository.AsSugarClient())
|
||||
{
|
||||
@@ -57,9 +60,8 @@ namespace Tnb.WarehouseMgr
|
||||
_cacheManager = cacheManager;
|
||||
_elevatorControlService = elevatorControlService;
|
||||
_ = InitializationTask;
|
||||
_redisData = redisData;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 根据载具Id带出库位、仓库信息
|
||||
/// </summary>
|
||||
@@ -223,6 +225,31 @@ namespace Tnb.WarehouseMgr
|
||||
.ToListAsync();
|
||||
return input.Size > 0 ? items.Take(input.Size).ToList() : items;
|
||||
}
|
||||
/// <summary>
|
||||
/// 判断CTU是否可以放货
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task CheckPut(CheckPutInput input)
|
||||
{
|
||||
Dictionary<string, string[]> dic = new Dictionary<string, string[]>();
|
||||
dic.Add("5号输送线点位", new string[] { "TY4C-ZHUSU1", "weighDone_5" });
|
||||
dic.Add("6号输送线点位", new string[] { "TY4C-ZHUSU1", "weighDone_6" });
|
||||
if (!dic.ContainsKey(input.point_code))
|
||||
throw new AppFriendlyException("点位" + input.point_code + "不存在", 500);
|
||||
var strs = dic.Where(p => p.Key == input.point_code).First().Value;
|
||||
bool flag = await _redisData.HashExist(strs[0], strs[1]);
|
||||
if (!flag)
|
||||
{
|
||||
throw new AppFriendlyException("点位" + input.point_code + "不存在", 500);
|
||||
}
|
||||
string data = await _redisData.GetHash(strs[0], strs[1]);
|
||||
JObject? res = JsonConvert.DeserializeObject<JObject>(data);
|
||||
bool result = res != null && res["Value"] != null ? res.Value<bool>("Value") : false;
|
||||
if (!result)
|
||||
throw new AppFriendlyException("点位" + input.point_code + "不可放", 500);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 生成任务执行
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user