From 71f390cadeb2f7d39d85fb4db37fb58bb4dbd51b Mon Sep 17 00:00:00 2001 From: majian <780924089@qq.com> Date: Sun, 15 Sep 2024 00:59:43 +0800 Subject: [PATCH] =?UTF-8?q?=E7=8E=B0=E5=9C=BA=E9=97=AE=E9=A2=98=E5=A4=84?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Tnb.ProductionMgr/RedisBackGround.cs | 34 +++++++++++++++---- .../Tnb.WarehouseMgr/DeviceProviderService.cs | 1 + .../Tnb.WarehouseMgr/WareHouseService.cs | 8 +++-- 3 files changed, 33 insertions(+), 10 deletions(-) diff --git a/ProductionMgr/Tnb.ProductionMgr/RedisBackGround.cs b/ProductionMgr/Tnb.ProductionMgr/RedisBackGround.cs index 2091c7ff..ce23cc35 100644 --- a/ProductionMgr/Tnb.ProductionMgr/RedisBackGround.cs +++ b/ProductionMgr/Tnb.ProductionMgr/RedisBackGround.cs @@ -2008,9 +2008,15 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA // 一托货 else if (group.Count() == 1) { - // 如果当前电梯没有执行中的任务 则呼叫电梯下 - if (db_ElevatorTaskExceptionHandle.Queryable().Where(r => r.status != WmsWareHouseConst.TASK_BILL_STATUS_COMPLE_ID - && r.status != WmsWareHouseConst.TASK_BILL_STATUS_CANCEL_ID && r.endlocation_id == wmsDistaskHs[0].startlocation_id).Count() == 0) + // 如果当前电梯没有执行中且货位不同的任务 则呼叫电梯下 + List _wmsDistaskHs = await db_ElevatorTaskExceptionHandle.Queryable() + .InnerJoin((a, b) => a.startlocation_id == b.location_id) + .Where((a, b) => a.status != WmsWareHouseConst.TASK_BILL_STATUS_COMPLE_ID + && a.status != WmsWareHouseConst.TASK_BILL_STATUS_CANCEL_ID && a.endlocation_id == wmsDistaskHs[0].startlocation_id + && !wmsElevator.innerpos.Contains(b.name) + ).ToListAsync(); + + if (_wmsDistaskHs.Count() == 0) { if (e != null) { @@ -2020,8 +2026,10 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA LoggerElevatorTask.Information($"【ElevatorTaskExceptionHandle】呼叫电梯 {e.elevator_code}"); await _wareHouseService.ExecuteTargetFloorTask(wmsDistaskHs, db_ElevatorTaskExceptionHandle); LoggerElevatorTask.Information($"【ElevatorTaskExceptionHandle】呼叫电梯 {e.elevator_code}执行完成"); - - + } + else + { + LoggerElevatorTask.Information($"【ElevatorTaskExceptionHandle】等待 {string.Join(',', _wmsDistaskHs.Select(r => r.carry_code ))}"); } } else @@ -2467,6 +2475,13 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA { if (s_taskFloor4DMC2CPKService.CurrentCount == 0) return; + var Floor4DMC2CPK = await db_Floor4DMC2CPK.Queryable().Where(p => p.key == "Floor4DMC2CPK").FirstAsync(); + // 0则不进行移转 + if (Floor4DMC2CPK != null && Floor4DMC2CPK.value == "0") + { + return; + } + await s_taskFloor4DMC2CPKService.WaitAsync(); Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); @@ -2504,11 +2519,16 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA continue; } + BasLocation startlocation = await db_Floor4DMC2CPK.Queryable().Where(r => r.id == wmsCarryH.location_id).FirstAsync(); + + if (startlocation.is_lock == 1) + { + LoggerFloor4DMC2CPK.LogWarning($"【四楼待灭菌线到灭菌仓】 起点库位{startlocation.location_code}已锁定"); + continue; + } await db_Floor4DMC2CPK.Ado.BeginTranAsync(); - BasLocation startlocation = await db_Floor4DMC2CPK.Queryable().Where(r => r.id == wmsCarryH.location_id).FirstAsync(); - InStockStrategyQuery inStockStrategyInput = new() { warehouse_id = WmsWareHouseConst.WAREHOUSE_CP_ID, diff --git a/WarehouseMgr/Tnb.WarehouseMgr/DeviceProviderService.cs b/WarehouseMgr/Tnb.WarehouseMgr/DeviceProviderService.cs index a4219930..7f693af9 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/DeviceProviderService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/DeviceProviderService.cs @@ -436,6 +436,7 @@ namespace Tnb.WarehouseMgr // 如果当前所放梯内货位已占用 if (wmsElevatorH.innerpos.Contains(wmsElevatorcacheArea.name)) { + Logger.LogInformation($"电梯{devName}内托盘{dis.carry_code}当前准备放置的货位已有货!"); return await ToApiResult(HttpStatusCode.InternalServerError, $"电梯{devName}内托盘{dis.carry_code}当前准备放置的货位已有货!"); } diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs index 926e51ea..db00288b 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs @@ -2565,8 +2565,10 @@ namespace Tnb.WarehouseMgr await db.Updateable(carryHs).ExecuteCommandAsync(); #region 电梯第三次改动 - // 一托下的时候切换首选电梯 - if (disTaskIds.Count == 1) + var _floor3FirstSelectElevator = await db_agvElevatorTaskExceptionHandles.Queryable().Where(p => p.key == "floor3FirstSelectElevator").FirstAsync(); + // 一托下且当前电梯还没有后续任务且首选电梯为当前电梯的情况下,切换首选电梯为另一部 + int task_nums = db.Queryable().Where(r => r.elevator_code == devName).Sum(r => r.task_nums); + if (disTaskIds.Count == 1 && task_nums == 1 && devName == _floor3FirstSelectElevator.value) { await ChangeSelectedElevator(db); } @@ -4539,7 +4541,7 @@ namespace Tnb.WarehouseMgr { List locations = await db_agvElevatorTaskExceptionHandles.Queryable() .InnerJoin((a, b) => a.id == b.location_id) - .Where((a, b) => b.name == YCLInnerTransfer.value && a.is_use == "1" && a.is_lock == 0).OrderBy("a.location_code").ToListAsync(); + .Where((a, b) => b.name == 切换发货区 && a.is_use == "1" && a.is_lock == 0).OrderBy("a.location_code").ToListAsync(); startloc = locations.FirstOrDefault(); #region 如果当前侧没有可用库位 切换另一侧继续发货,但是因为不能同时发两托同侧的货到同个电梯,所以必须保证当前优先级电梯是接第一托货