1
This commit is contained in:
@@ -57,6 +57,7 @@ namespace Tnb.WarehouseMgr
|
||||
private static Dictionary<string, object> locMap = new Dictionary<string, object>(StringComparer.OrdinalIgnoreCase);
|
||||
private readonly IConfiguration _configuration;
|
||||
private readonly RedisData _redisData;
|
||||
|
||||
public Func<string, int, Task> AddUnExecuteTask { get; set; }
|
||||
|
||||
|
||||
@@ -270,6 +271,80 @@ namespace Tnb.WarehouseMgr
|
||||
throw new AppFriendlyException("点位" + input.targetName + "不可放", 500);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 判断CTU是否可以取货
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[AllowAnonymous]
|
||||
public async Task<dynamic> CheckGet()
|
||||
{
|
||||
try
|
||||
{
|
||||
Dictionary<string, string[]> getdic = new Dictionary<string, string[]>();
|
||||
getdic.Add("SSX-021-005", new string[] { "YTCS", "AllowFullOut_CS05", "LiftCode" });
|
||||
|
||||
var strs = getdic.First().Value;
|
||||
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)
|
||||
{
|
||||
string codedata = _redisData.GetHash(strs[0], strs[2]).Result;
|
||||
JObject? coderes = JsonConvert.DeserializeObject<JObject>(codedata);
|
||||
string coderesult = coderes != null && coderes["Value"] != null ? coderes.Value<string>("Value")! : "";
|
||||
return new { flag =true, code = coderesult };
|
||||
}
|
||||
else
|
||||
{
|
||||
return new { flag = false, code = "" };
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new AppFriendlyException($"接口请求异常", 500);
|
||||
}
|
||||
}
|
||||
public async Task SsxControl(WmsDistaskH disTask, string action)
|
||||
{
|
||||
Dictionary<string, string[]> putdic = new Dictionary<string, string[]>();
|
||||
Dictionary<string, string[]> getdic = new Dictionary<string, string[]>();
|
||||
getdic.Add("SSX-021-005", new string[] { "YTCS", "AllowFullOut_CS05", "true" });
|
||||
putdic.Add("SSX-021-006", new string[] { "YTCS", "", "" });
|
||||
if (action == "LOAD")//取货
|
||||
{
|
||||
if (getdic.Keys.Contains(disTask.startlocation_code))
|
||||
{
|
||||
var strarr = getdic.Where(p => p.Key == disTask.startlocation_code).First().Value;
|
||||
Dictionary<string, string> dicCommand = new(StringComparer.OrdinalIgnoreCase)
|
||||
{
|
||||
["DevName"] = strarr[0],
|
||||
["token"] = _eleCtlCfg.token,
|
||||
["TagName"] = strarr[1],
|
||||
["Value"] = strarr[2],
|
||||
};
|
||||
await HttpClientHelper.GetAsync(_eleCtlCfg.WriteTagUrl, pars: dicCommand);
|
||||
}
|
||||
}
|
||||
else if (action == "UNLOAD")//放货
|
||||
{
|
||||
if (putdic.Keys.Contains(disTask.endlocation_code))
|
||||
{
|
||||
var strarr = putdic.Where(p => p.Key == disTask.endlocation_code).First().Value;
|
||||
Dictionary<string, string> dicCommand = new(StringComparer.OrdinalIgnoreCase)
|
||||
{
|
||||
["DevName"] = strarr[0],
|
||||
["token"] = _eleCtlCfg.token,
|
||||
["TagName"] = strarr[1],
|
||||
["Value"] = strarr[2],
|
||||
};
|
||||
await HttpClientHelper.GetAsync(_eleCtlCfg.WriteTagUrl, pars: dicCommand);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 生成任务执行
|
||||
/// </summary>
|
||||
@@ -1058,6 +1133,8 @@ namespace Tnb.WarehouseMgr
|
||||
}
|
||||
|
||||
await _db.Ado.CommitTranAsync();
|
||||
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user