解决冲突

This commit is contained in:
yang.lee
2023-12-12 14:29:34 +08:00
5 changed files with 246 additions and 5 deletions

View File

@@ -12,13 +12,16 @@ using JNPF.FriendlyException;
using JNPF.Systems.Interfaces.System;
using Mapster;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.CodeAnalysis;
using Microsoft.Extensions.Configuration;
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;
@@ -63,8 +66,6 @@ namespace Tnb.WarehouseMgr
_elevatorControlService = elevatorControlService;
//_configuration = configuration;
}
/// <summary>
/// 根据载具Id带出库位、仓库信息
/// </summary>
@@ -228,6 +229,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>