1
This commit is contained in:
@@ -121,8 +121,7 @@ namespace Tnb.ProductionMgr
|
||||
private void CheckGet(object state)
|
||||
{
|
||||
Dictionary<string, string[]> getdic = new Dictionary<string, string[]>();
|
||||
getdic.Add("SSX-021-005", new string[] { "CS05", "FullBoxAllowGet", "Code" });
|
||||
getdic.Add("SSX-021-006", new string[] { "CS06", "FullBoxAllowGet", "Code" });
|
||||
getdic.Add("SSX-021-005", new string[] { "YTCS", "AllowFullOut_CS05", "LiftCode" });
|
||||
foreach (var key in getdic.Keys)
|
||||
{
|
||||
try
|
||||
@@ -138,14 +137,16 @@ namespace Tnb.ProductionMgr
|
||||
JObject? coderes = JsonConvert.DeserializeObject<JObject>(codedata);
|
||||
string coderesult = coderes != null && coderes["Value"] != null ? coderes.Value<string>("Value")! : "";
|
||||
var DistaskH = _repository.AsSugarClient().Queryable<WmsDistaskH>().Where(p => p.carry_code == coderesult && p.status == WmsWareHouseConst.TASK_BILL_STATUS_RUNING_ID).First();
|
||||
dynamic reqBody = new ExpandoObject();
|
||||
reqBody.taskCode = DistaskH.bill_code;
|
||||
reqBody.slotCode = key;
|
||||
reqBody.containerCode = coderesult;
|
||||
CancellationTokenSource Ctu = new();
|
||||
//{"code":500,"msg":"成功!"}
|
||||
dynamic respBody = HttpClientHelper.PostStreamAsync("http://192.168.11.104:1880/wcs/notify/cargo", reqBody, Ctu.Token).Result;
|
||||
Ctu.Dispose();
|
||||
if (DistaskH != null)
|
||||
{
|
||||
dynamic reqBody = new ExpandoObject();
|
||||
reqBody.taskCode = DistaskH.bill_code;
|
||||
reqBody.slotCode = key;
|
||||
reqBody.containerCode = coderesult;
|
||||
CancellationTokenSource Ctu = new();
|
||||
dynamic respBody = HttpClientHelper.PostStreamAsync("http://192.168.11.104:1880/wcs/notify/cargo", reqBody, Ctu.Token).Result;
|
||||
Ctu.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
@@ -190,7 +191,7 @@ namespace Tnb.ProductionMgr
|
||||
public Task StartAsync(CancellationToken cancellationToken)
|
||||
{
|
||||
// Readtimer = new Timer(GetRedisData, null, TimeSpan.Zero, TimeSpan.FromSeconds(300));
|
||||
// CheckGettimer = new Timer(CheckGet, null, TimeSpan.Zero, TimeSpan.FromSeconds(300));
|
||||
CheckGettimer = new Timer(CheckGet, null, TimeSpan.Zero, TimeSpan.FromSeconds(60));
|
||||
// Scantimer = new Timer(ScanInStock, null, TimeSpan.Zero, TimeSpan.FromSeconds(300));
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
@@ -74,6 +74,7 @@ namespace Tnb.WarehouseMgr.Interfaces
|
||||
/// <param name="ele"></param>
|
||||
/// <returns></returns>
|
||||
Task<List<WmsPointH>> PathAlgorithmsEle(string pStartId, string pEndId, int ele);
|
||||
Task SsxControl(WmsDistaskH disTask, string action);
|
||||
Func<string, int, Task> AddUnExecuteTask { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -403,7 +403,7 @@ namespace Tnb.WarehouseMgr
|
||||
{
|
||||
_ = await _db.Deleteable(elevatorQueueItem).ExecuteCommandAsync();
|
||||
}
|
||||
|
||||
await _wareHouseService.SsxControl(disTask, "LOAD");
|
||||
}
|
||||
else if (input.action == "UNLOAD")
|
||||
{
|
||||
@@ -414,7 +414,7 @@ namespace Tnb.WarehouseMgr
|
||||
};
|
||||
Logger.Information($"taskCompleUpInput json parameter:{JsonConvert.SerializeObject(taskCompleUpInput)}");
|
||||
await _wareHouseService.TaskComplate(taskCompleUpInput);
|
||||
|
||||
await _wareHouseService.SsxControl(disTask, "UNLOAD");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
"ConnectionStrings": {
|
||||
"ConfigId": "default",
|
||||
"DBType": "PostgreSQL", //MySql;SqlServer;Oracle;PostgreSQL;Dm;Kdbndp;Sqlite;
|
||||
"Host": "localhost",
|
||||
"Host": "192.168.11.109",
|
||||
"Port": "5432",
|
||||
//"DBName": "tianyi_db",
|
||||
//"UserName": "postgres",
|
||||
//"Password": "pass@word123",
|
||||
"DBName": "tianyi_bas",
|
||||
"UserName": "totong",
|
||||
"Password": "IPANyxGSKxIXg0dBM",
|
||||
"DBName": "tianyi",
|
||||
"UserName": "postgres",
|
||||
"Password": "pass@word123",
|
||||
//SqlServer
|
||||
//"DefaultConnection": "server={0},{1};database={2};uid={3};pwd={4};MultipleActiveResultSets=true"
|
||||
//Kdbndp
|
||||
|
||||
@@ -62,7 +62,7 @@ public class Startup : AppStartup
|
||||
services.AddSingleton<BackgroundService, TimedTaskBackgroundService>(sp => new TimedTaskBackgroundService());
|
||||
//var bgSvc = App.GetRequiredService<BackgroundService>();
|
||||
//bgSvc.StartAsync(CancellationToken.None);
|
||||
//services.AddHostedService<RedisBackGround>();
|
||||
services.AddHostedService<RedisBackGround>();
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user