wms接入redis
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Tnb.WarehouseMgr.Entities.Dto.Inputs
|
||||
{
|
||||
public class CheckPutInput
|
||||
{
|
||||
public string point_code { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -44,11 +44,11 @@ namespace Tnb.WarehouseMgr
|
||||
|
||||
//遍历字典,找出需要查询数据库拿的相关字段
|
||||
foreach (Dictionary<string, object> d in dics)
|
||||
{
|
||||
{ /*
|
||||
if (d.Select(x => x.Value.ToString()).ToList().Find(v => v != "" && v != string.Empty && v != null) == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}*/
|
||||
string LCode = d["location_code"]?.ToString() ?? string.Empty;
|
||||
if (LCode == string.Empty)
|
||||
{
|
||||
@@ -134,13 +134,14 @@ namespace Tnb.WarehouseMgr
|
||||
{
|
||||
row = await _db.Fastest<BasLocation>().BulkCopyAsync(locs);
|
||||
}
|
||||
/*
|
||||
else if (locs.Count > 400)
|
||||
{
|
||||
_db.Utilities.PageEach(locs, 100, async pageList =>
|
||||
{
|
||||
row = await _db.Insertable(pageList).ExecuteCommandAsync();
|
||||
});
|
||||
}
|
||||
}*/
|
||||
else
|
||||
{
|
||||
row = await _db.Insertable(locs).ExecuteCommandAsync();
|
||||
|
||||
@@ -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