原材料转库逻辑变更

This commit is contained in:
2024-05-24 14:24:21 +08:00
parent 2a66f244dd
commit 36622b35cf
8 changed files with 376 additions and 112 deletions

View File

@@ -212,26 +212,22 @@ namespace Tnb.ProductionMgr
coderesult = coderesult.Replace("\r", "");
Logger.LogInformation($@"【定时任务CheckGet】 成功取到{strs[2]}值:{coderesult}");
var DistaskH = _repository.AsSugarClient().Queryable<WmsDistaskH>().Where(p => p.carry_code == coderesult && p.status == WmsWareHouseConst.TASK_BILL_STATUS_YXD_ID && string.IsNullOrEmpty(p.extras)).First();
if (DistaskH != null)
{
Logger.LogInformation($@"【定时任务CheckGet】 DistaskH != null");
Logger.LogInformation($@"【定时任务CheckGet】 成功找到载具:{coderesult} 对应的任务执行单{DistaskH.bill_code}");
dynamic reqBody = new ExpandoObject();
reqBody.taskCode = DistaskH.bill_code;
reqBody.slotCode = key;
reqBody.containerCode = coderesult;
CancellationTokenSource Ctu = new();
if (strs[0] == "东面提升机输送线")
{
Logger.LogInformation($"【定时任务CheckGet】 开始发送请求到 http://192.168.11.104:1880/wcs/notify/cargo 载具:{coderesult}");
}
Logger.LogInformation($"【定时任务CheckGet】 开始发送请求到 http://192.168.11.104:1880/wcs/notify/cargo 载具:{coderesult}");
dynamic respBody = HttpClientHelper.PostStreamAsync("http://192.168.11.104:1880/wcs/notify/cargo", reqBody, Ctu.Token).Result;
if (strs[0] == "东面提升机输送线")
{
Logger.LogInformation($"【定时任务CheckGet】 接收请求 http://192.168.11.104:1880/wcs/notify/cargo 结果 {respBody} ");
}
Logger.LogInformation($"【定时任务CheckGet】 接收请求 http://192.168.11.104:1880/wcs/notify/cargo 结果 {respBody} ");
DistaskH.extras = respBody;
_repository.AsSugarClient().Updateable(DistaskH).ExecuteCommand();
Ctu.Dispose();
@@ -248,22 +244,22 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
}
else
{
Logger.LogInformation($@"【定时任务CheckGet】 DistaskH == null");
var DistaskH = _repository.AsSugarClient().Queryable<WmsDistaskH>().Where(p => p.startlocation_code == key && p.status == WmsWareHouseConst.TASK_BILL_STATUS_YXD_ID && string.IsNullOrEmpty(p.extras)).First();
if (DistaskH != null)
{
dynamic reqBody = new ExpandoObject();
reqBody.taskCode = DistaskH.bill_code;
reqBody.slotCode = key;
reqBody.containerCode = DistaskH.carry_code;
CancellationTokenSource Ctu = new();
Logger.LogInformation($"【定时任务CheckGet】 开始发送请求到 http://192.168.11.104:1880/wcs/notify/cargo ");
dynamic respBody = HttpClientHelper.PostStreamAsync("http://192.168.11.104:1880/wcs/notify/cargo", reqBody, Ctu.Token).Result;
Logger.LogInformation($"【定时任务CheckGet】 接收请求 http://192.168.11.104:1880/wcs/notify/cargo 结果 {respBody} ");
DistaskH.extras = respBody;
_repository.AsSugarClient().Updateable(DistaskH).ExecuteCommand();
Ctu.Dispose();
}
Logger.LogInformation($@"【定时任务CheckGet】 strs[2]信号为空 {strs[2]}");
//var DistaskH = _repository.AsSugarClient().Queryable<WmsDistaskH>().Where(p => p.startlocation_code == key && p.status == WmsWareHouseConst.TASK_BILL_STATUS_YXD_ID && string.IsNullOrEmpty(p.extras)).First();
//if (DistaskH != null)
//{
// dynamic reqBody = new ExpandoObject();
// reqBody.taskCode = DistaskH.bill_code;
// reqBody.slotCode = key;
// reqBody.containerCode = DistaskH.carry_code;
// CancellationTokenSource Ctu = new();
// Logger.LogInformation($"【定时任务CheckGet】 开始发送请求到 http://192.168.11.104:1880/wcs/notify/cargo ");
// dynamic respBody = HttpClientHelper.PostStreamAsync("http://192.168.11.104:1880/wcs/notify/cargo", reqBody, Ctu.Token).Result;
// Logger.LogInformation($"【定时任务CheckGet】 接收请求 http://192.168.11.104:1880/wcs/notify/cargo 结果 {respBody} ");
// DistaskH.extras = respBody;
// _repository.AsSugarClient().Updateable(DistaskH).ExecuteCommand();
// Ctu.Dispose();
//}
}
}
}
@@ -1095,6 +1091,12 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
{
{"上升降机请求送空托1","二楼上升降机机械臂左"},
{"上升降机请求送空托2","二楼上升降机机械臂右"},
{"下升降机请求送满托1","二楼下升降机机械臂左"},
{"下升降机请求送满托2","二楼下升降机机械臂右"},
{"上升降机请求取满托1","二楼上升降机机械臂左"},
{"上升降机请求取满托2","二楼上升降机机械臂右"},
{"下升降机请求取空托1","二楼下升降机机械臂左"},
{"下升降机请求取空托2","二楼下升降机机械臂右"},
};
/// <summary>
/// 送空托到上升降区
@@ -1104,12 +1106,16 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
{
#region
List<string> configs_upMachine = new List<string>();
bool 1 = await Floor2UpDownMachinecode_GetTag<bool>($"上升降机请求送空托1");
bool 2 = await Floor2UpDownMachinecode_GetTag<bool>($"上升降机请求送空托2");
if (await Floor2UpDownMachinecode_GetTag<bool>($"上升降机请求送空托1"))
{
LoggerFloor2RackDelivery.LogError($"【送空托到上升降区】上升降机请求送空托1 true");
configs_upMachine.Add(floor2mechanicalAtmDic["上升降机请求送空托1"]);
}
if (await Floor2UpDownMachinecode_GetTag<bool>($"上升降机请求送空托2"))
{
LoggerFloor2RackDelivery.LogError($"【送空托到上升降区】上升降机请求送空托2 true");
configs_upMachine.Add(floor2mechanicalAtmDic["上升降机请求送空托2"]);
}
// 没有有效信号
if (configs_upMachine.Count == 0)
@@ -1224,10 +1230,27 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
/// <returns></returns>
public async Task<bool> ()
{
#region
List<string> configs_upMachine = new List<string>();
if (await Floor2UpDownMachinecode_GetTag<bool>($"下升降机请求送满托1"))
{
LoggerFloor2RackDelivery.LogError($"【送满托到下升降区】下升降机请求送满托1 true");
configs_upMachine.Add(floor2mechanicalAtmDic["下升降机请求送满托1"]);
}
if (await Floor2UpDownMachinecode_GetTag<bool>($"下升降机请求送满托2"))
{
LoggerFloor2RackDelivery.LogError($"【送满托到下升降区】下升降机请求送满托2 true");
configs_upMachine.Add(floor2mechanicalAtmDic["下升降机请求送满托2"]);
}
// 没有有效信号
if (configs_upMachine.Count == 0)
return false;
#endregion
using (var db = _repository.AsSugarClient().CopyNew())
{
string[] configs_upMachine = new string[2] { "二楼下升降机机械臂左", "二楼下升降机机械臂右" };
// 找到没有绑定料架的且库位未锁定的料架区
ISugarQueryable<WmsMechanicalArmH> WmsMechanicalArmHsuagar = db.Queryable<WmsMechanicalArmH>().
InnerJoin<WmsPointH>((a, b) => a.point_id == b.id)
@@ -1245,14 +1268,12 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
// 料架区
foreach (WmsMechanicalArmH wmsMechanicalArmH in WmsMechanicalArmHs)
{
bool = await Floor2UpDownMachinecode_GetTag<bool>($"下升降机请求送满托{wmsMechanicalArmH.stackingposition}");
if (!)
{
LoggerFloor2RackDelivery.LogWarning($"【送满托到下升降区】 料架区 {wmsMechanicalArmH.name}{wmsMechanicalArmH.stackingposition} 下升降机请求送满托{wmsMechanicalArmH.stackingposition}信号不为true");
return false;
}
//bool 下升降机请求送满托 = await Floor2UpDownMachinecode_GetTag<bool>($"下升降机请求送满托{wmsMechanicalArmH.stackingposition}");
//if (!下升降机请求送满托)
//{
// LoggerFloor2RackDelivery.LogWarning($"【送满托到下升降区】 料架区 {wmsMechanicalArmH.name}{wmsMechanicalArmH.stackingposition} 下升降机请求送满托{wmsMechanicalArmH.stackingposition}信号不为true");
// return false;
//}
// 找到占用且未锁定的库位上的满料架且料架中的料箱是空的
List<BasLocation> rackStartLocations =
@@ -1337,11 +1358,6 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
{
is_lock = 1
}).Where(r => r.id == endPoint.location_id).ExecuteCommandAsync();
//await _repository.AsSugarClient().Updateable<WmsPointH>().SetColumns(r => new WmsPointH
//{
// is_lock = 1
//}).Where(r => r.id == endPoint.id).ExecuteCommandAsync();
LoggerFloor2RackDelivery.LogInformation($"【送满托到下升降区】 开始生成预任务 起点{startPoint.point_code} 终点{endPoint.point_code} 料架 {targetCarry.carry_code}");
List<WmsPointH> points = new List<WmsPointH>();
@@ -1365,9 +1381,26 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
/// <returns></returns>
public async Task<bool> ()
{
#region
List<string> configs_upMachine = new List<string>();
if (await Floor2UpDownMachinecode_GetTag<bool>($"上升降机请求取满托1"))
{
LoggerFloor2RackDelivery.LogError($"【移走上升降区未生成预任务且满托的料架】上升降机请求取满托1 true");
configs_upMachine.Add(floor2mechanicalAtmDic["上升降机请求取满托1"]);
}
if (await Floor2UpDownMachinecode_GetTag<bool>($"上升降机请求取满托2"))
{
LoggerFloor2RackDelivery.LogError($"【移走上升降区未生成预任务且满托的料架】上升降机请求取满托2 true");
configs_upMachine.Add(floor2mechanicalAtmDic["上升降机请求取满托2"]);
}
// 没有有效信号
if (configs_upMachine.Count == 0)
return false;
#endregion
using (var db = _repository.AsSugarClient().CopyNew())
{
string[] configs_upMachine = new string[2] { "二楼上升降机机械臂左", "二楼上升降机机械臂右" };
// 读取上升降机的左右料架区配置
List<WmsMechanicalArmH> WmsMechanicalArmHs = db.Queryable<WmsMechanicalArmH>().Where(r => r.stackingcount == r.maxnum && r.maxnum != 0 && !string.IsNullOrEmpty(r.rackcode) && r.iscreatepretask == 0 && configs_upMachine.Contains(r.name) && r.mechanicalconfirm == 1).ToList();
@@ -1378,13 +1411,13 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
LoggerFloor2RackDelivery.LogInformation($"【移走上升降区满托的料架】 开始执行预任务生成 {wmsMechanicalArmH.point_code} {wmsMechanicalArmH.outbill} {wmsMechanicalArmH.barcodes}");
try
{
// 判断是否 上升降机请求取满托
bool = await Floor2UpDownMachinecode_GetTag<bool>($"上升降机请求取满托{wmsMechanicalArmH.stackingposition}");
LoggerFloor2RackDelivery.LogError($"【移走上升降区满托的料架】上升降机请求取满托{wmsMechanicalArmH.stackingposition} {上升降机请求取满托}");
if (!)
{
continue;
}
//// 判断是否 上升降机请求取满托
//bool 上升降机请求取满托 = await Floor2UpDownMachinecode_GetTag<bool>($"上升降机请求取满托{wmsMechanicalArmH.stackingposition}");
//LoggerFloor2RackDelivery.LogError($"【移走上升降区满托的料架】上升降机请求取满托{wmsMechanicalArmH.stackingposition} {上升降机请求取满托}");
//if (!上升降机请求取满托)
//{
// continue;
//}
await db.Updateable<WmsMechanicalArmH>().SetColumns(r => new WmsMechanicalArmH
{
@@ -1471,9 +1504,26 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
/// <returns></returns>
public async Task<bool> ()
{
#region
List<string> configs_upMachine = new List<string>();
if (await Floor2UpDownMachinecode_GetTag<bool>($"下升降机请求取空托1"))
{
LoggerFloor2RackDelivery.LogError($"【移走下升降区空托的料架】下升降机请求取空托1 true");
configs_upMachine.Add(floor2mechanicalAtmDic["下升降机请求取空托1"]);
}
if (await Floor2UpDownMachinecode_GetTag<bool>($"下升降机请求取空托2"))
{
LoggerFloor2RackDelivery.LogError($"【移走下升降区空托的料架】下升降机请求取空托2 true");
configs_upMachine.Add(floor2mechanicalAtmDic["下升降机请求取空托2"]);
}
// 没有有效信号
if (configs_upMachine.Count == 0)
return false;
#endregion
using (var db = _repository.AsSugarClient().CopyNew())
{
string[] configs_upMachine = new string[2] { "二楼下升降机机械臂左", "二楼下升降机机械臂右" };
// 读取下升降机的左右料架区配置
List<WmsMechanicalArmH> WmsMechanicalArmHs = db.Queryable<WmsMechanicalArmH>().Where(r => !string.IsNullOrEmpty(r.rackcode) && r.iscreatepretask == 0 && configs_upMachine.Contains(r.name)).ToList();
@@ -1482,13 +1532,13 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
{
try
{
// 判断是否 上升降机请求取满托
bool = await Floor2UpDownMachinecode_GetTag<bool>($"下升降机请求取空托{wmsMechanicalArmH.stackingposition}");
LoggerFloor2RackDelivery.LogError($"【移走下升降区空托的料架】下升降机请求取空托{wmsMechanicalArmH.stackingposition} {下升降机请求取空托}" );
if (!)
{
return false;
}
//// 判断是否 上升降机请求取满托
//bool 下升降机请求取空托 = await Floor2UpDownMachinecode_GetTag<bool>($"下升降机请求取空托{wmsMechanicalArmH.stackingposition}");
//LoggerFloor2RackDelivery.LogError($"【移走下升降区空托的料架】下升降机请求取空托{wmsMechanicalArmH.stackingposition} {下升降机请求取空托}" );
//if (!下升降机请求取空托)
//{
// return false;
//}
LoggerFloor2RackDelivery.LogInformation($"【移走下升降区空托的料架】 开始执行预任务生成 {wmsMechanicalArmH.point_code} {wmsMechanicalArmH.outbill} {wmsMechanicalArmH.barcodes}");