From 1089bd7f5ac6262a963afd22c04cb1421b0c5f4c Mon Sep 17 00:00:00 2001 From: majian <780924089@qq.com> Date: Wed, 26 Jun 2024 14:27:32 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=8C=E6=AD=A5=E6=96=99=E6=9E=B6=E7=9A=84?= =?UTF-8?q?=E8=BD=BD=E5=85=B7=E4=BD=8D=E7=BD=AE=EF=BC=8Cbug=E5=A4=84?= =?UTF-8?q?=E7=90=86=EF=BC=8C=E6=97=A5=E5=BF=97=E5=AE=8C=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Tnb.ProductionMgr/RedisBackGround.cs | 20 +++++++++---------- .../Tnb.WarehouseMgr/PcStroageService.cs | 2 ++ .../Tnb.WarehouseMgr/WareHouseService.cs | 20 +++++++++++++++++-- .../Tnb.WarehouseMgr/WmsCarryBindService.cs | 3 +++ 4 files changed, 33 insertions(+), 12 deletions(-) diff --git a/ProductionMgr/Tnb.ProductionMgr/RedisBackGround.cs b/ProductionMgr/Tnb.ProductionMgr/RedisBackGround.cs index c9e6b25f..e9336d86 100644 --- a/ProductionMgr/Tnb.ProductionMgr/RedisBackGround.cs +++ b/ProductionMgr/Tnb.ProductionMgr/RedisBackGround.cs @@ -213,7 +213,7 @@ namespace Tnb.ProductionMgr { LoggerSSX.LogInformation($@"【定时任务CheckGet】 {key}->{strs[0]} {strs[2]} 采集结果:{$@"任务执行(wms_distask_h)中找不到匹配的记录 任务执行需要存在载具编号(carry_code)为{coderesult} -且单据状态(status)为已下达(26126853976101) 且扩展字段(extras)为空的记录 +且单据状态(status)为已下达(26126853976101) 且扩展字段(extras)为空的记录 (可能是WCS系统中存在载具{coderesult}的历史任务未清空) select extras,* from wms_distask_h where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STATUS_YXD_ID}' "}"); @@ -510,7 +510,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA LoggerBGWCarrySupplement.LogInformation($"【BGWCarrySupplementtimer】锁定起点库位 开始生成 {startLocation.location_code} 到 {endLocation.location_code} 预任务 "); - bool result_createPretask = await createPretask(startLocation.id, endLocation.id, "", "", LoggerBGWCarrySupplement); + bool result_createPretask = await createPretask(startLocation.id, endLocation.id, "", "", LoggerBGWCarrySupplement, db_BGWCarrySupplementtimer); if (!result_createPretask) { LoggerBGWCarrySupplement.LogWarning($"【BGWCarrySupplementtimer】 {startLocation.location_code} 到 {endLocation.location_code} 预任务生成失败 "); @@ -599,7 +599,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA //锁定终点库位 await db_YCLGLDPJInstocktimer.Updateable().SetColumns(r => new BasLocation { is_lock = 1 }).Where(r => r.id == endLocation.id).ExecuteCommandAsync(); - bool result_createPretask = await createPretask(startLocation.id, endLocation.id, "", "", LoggerYCLGLDPJInstock); + bool result_createPretask = await createPretask(startLocation.id, endLocation.id, "", "", LoggerYCLGLDPJInstock, db_YCLGLDPJInstocktimer); if (!result_createPretask) { LoggerYCLGLDPJInstock.LogWarning($"【YCLGLDPJInstock】 {startLocation.location_code} 到 {endLocation.location_code} 预任务生成失败"); @@ -684,7 +684,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA //锁定终点库位 await db_YCLWXDPJInstocktimer.Updateable().SetColumns(r => new BasLocation { is_lock = 1 }).Where(r => r.id == endLocation.id).ExecuteCommandAsync(); - bool result_createPretask = await createPretask(startLocation.id, endLocation.id, "", "", LoggerYCLGLDPJInstock); + bool result_createPretask = await createPretask(startLocation.id, endLocation.id, "", "", LoggerYCLGLDPJInstock, db_YCLWXDPJInstocktimer); if (!result_createPretask) { LoggerYCLGLDPJInstock.LogWarning($"【YCLWXDPJInstock】 {startLocation.location_code} 到 {endLocation.location_code} 预任务生成失败"); @@ -1089,7 +1089,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA LoggerFloor2RackDelivery.LogInformation($"【送空托到上升降区】 开始生成预任务 起点{startLocation.location_code} 终点{wmsMechanicalArmH.location_code} 料架 {targetCarry.carry_code}"); - bool result = await createPretask(startLocation.id, wmsMechanicalArmH.location_id, targetCarry.id, targetCarry.carry_code, LoggerFloor2RackDelivery); + bool result = await createPretask(startLocation.id, wmsMechanicalArmH.location_id, targetCarry.id, targetCarry.carry_code, LoggerFloor2RackDelivery, db_Floor2timer送空托到上升降区); if (!result) { LoggerFloor2RackDelivery.LogInformation($"【送空托到上升降区】 未成功生成预任务 起点{startLocation.location_code} 终点{wmsMechanicalArmH.location_code} 料架 {targetCarry.carry_code}"); @@ -1244,7 +1244,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA LoggerFloor2RackDelivery.LogInformation($"【送满托到下升降区】 开始生成预任务 起点{startLocation.location_code} 终点{wmsMechanicalArmH.location_code} 料架 {targetCarry.carry_code}"); - bool result = await createPretask(startLocation.id, wmsMechanicalArmH.location_id, targetCarry.id, targetCarry.carry_code, LoggerFloor2RackDelivery); + bool result = await createPretask(startLocation.id, wmsMechanicalArmH.location_id, targetCarry.id, targetCarry.carry_code, LoggerFloor2RackDelivery, db_Floor2timer送满托到下升降区); if (!result) { LoggerFloor2RackDelivery.LogInformation($"【送满托到下升降区】 未成功生成预任务 起点{startLocation.location_code} 终点{wmsMechanicalArmH.location_code} 料架 {targetCarry.carry_code}"); @@ -1345,7 +1345,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA LoggerFloor2RackDelivery.LogInformation($"【移走上升降区满托的料架】 开始执行预任务生成: 料架区为{wmsMechanicalArmH.name}{wmsMechanicalArmH.stackingposition} 料架为{wmsMechanicalArmH.rackcode}"); - bool result = await createPretask(wmsMechanicalArmH.location_id, endLocation.id, wmsMechanicalArmH.rackid, wmsMechanicalArmH.rackcode, LoggerFloor2RackDelivery); + bool result = await createPretask(wmsMechanicalArmH.location_id, endLocation.id, wmsMechanicalArmH.rackid, wmsMechanicalArmH.rackcode, LoggerFloor2RackDelivery, db_Floor2timer移走上升降区未生成预任务且满托的料架); if (!result) { LoggerFloor2RackDelivery.LogError($"【移走上升降区满托的料架】 未成功生成预任务 起点{wmsMechanicalArmH.location_code} 终点{endLocation.location_code} 料架 {wmsMechanicalArmH.rackcode}"); @@ -1454,7 +1454,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA LoggerFloor2RackDelivery.LogInformation($"【移走下升降区空托的料架】 开始执行预任务生成: 料架区为{wmsMechanicalArmH.name}{wmsMechanicalArmH.stackingposition} 料架为{wmsMechanicalArmH.rackcode}"); - bool result = await createPretask(wmsMechanicalArmH.location_id, endLocation.id, wmsMechanicalArmH.rackid, wmsMechanicalArmH.rackcode, LoggerFloor2RackDelivery); + bool result = await createPretask(wmsMechanicalArmH.location_id, endLocation.id, wmsMechanicalArmH.rackid, wmsMechanicalArmH.rackcode, LoggerFloor2RackDelivery, db_Floor2timer移走下升降区未生成预任务且空托的料架); if (!result) { LoggerFloor2RackDelivery.LogInformation($"【移走下升降区空托的料架】 未成功生成预任务 起点{wmsMechanicalArmH.location_code} 终点{endLocation.location_code} 料架 {wmsMechanicalArmH.rackcode}"); @@ -1481,7 +1481,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA } // 上下升降机生成预任务(补充料架、上升降机取货到料架、上升降机满托运走,下升降机拿货到输送线、下升降机空托运走) - private async Task createPretask(string startlocation_id, string endlocation_id, string carry_id, string carry_code, ILogger logger) + private async Task createPretask(string startlocation_id, string endlocation_id, string carry_id, string carry_code, ILogger logger, ISqlSugarClient dbConn) { CommonCreatePretaskInput commonCreatePretaskInput = new CommonCreatePretaskInput(); commonCreatePretaskInput.startlocation_id = startlocation_id; @@ -1494,7 +1494,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA commonCreatePretaskInput.isExcuteMission = false; logger.LogInformation($"开始执行 GenPreTask {JsonConvert.SerializeObject(commonCreatePretaskInput)}"); - var res = await _wareHouseService.CommonCreatePretask(commonCreatePretaskInput); + var res = await _wareHouseService.CommonCreatePretask(commonCreatePretaskInput, dbConn); if (res.code == JNPF.Common.Enums.HttpStatusCode.OK) { logger.LogInformation($"GenPreTask 结果 {JsonConvert.SerializeObject(res)}"); diff --git a/WarehouseMgr/Tnb.WarehouseMgr/PcStroageService.cs b/WarehouseMgr/Tnb.WarehouseMgr/PcStroageService.cs index 2e918e44..4ce41994 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/PcStroageService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/PcStroageService.cs @@ -20,6 +20,8 @@ namespace Tnb.WarehouseMgr public async Task Do(WareHouseUpInput input) { + if (string.IsNullOrEmpty(input.bizTypeId)) + return; if (_serviceMap.ContainsKey(input.bizTypeId)) { await _serviceMap[input.bizTypeId].ModifyAsync(input); diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs index c541e38d..a39cfc16 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs @@ -2068,6 +2068,20 @@ namespace Tnb.WarehouseMgr location_code = multiList[i].endlocation_code }; string endLocId = multiList[i].endlocation_id; + + // 同步料架下的载具位置 + if (carry.carrystd_id == WmsWareHouseConst.CARRY_LJSTD_ID) + { + List carrys = _db.Queryable().Where(r => r.carry_id == carry.id) + .InnerJoin((a, b) => a.membercarry_id == b.id).Select((a, b) => b).ToList(); + carrys.ForEach(r => + { + r.location_id = carry.location_id; + r.location_code = carry.location_code; + carryIts.Add(r); + }); + } + WmsCarryCode carryCode = new() { warehouse_id = locWhIdMap.ContainsKey(endLocId) ? locWhIdMap[endLocId].ToString() : "", @@ -2796,7 +2810,10 @@ namespace Tnb.WarehouseMgr var db = _db; if (dbConn != null) db = dbConn; - + else + db = _db.CopyNew(); + + { await s_taskCommonCreatePretask.WaitAsync(); Logger.LogInformation($"【createPretask】 接收到请求 参数:{JsonConvert.SerializeObject(input)}"); @@ -2885,7 +2902,6 @@ namespace Tnb.WarehouseMgr WmsPointH? sPoint = it.FirstOrDefault(); WmsPointH? ePoint = it.LastOrDefault(); - preTask = new() { org_id = _userManager.User?.OrganizeId, diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryBindService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryBindService.cs index 88ee29c9..70351ca4 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryBindService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryBindService.cs @@ -245,6 +245,7 @@ namespace Tnb.WarehouseMgr await _runService.Create(templateEntity, visualDevModelCrInput); await _db.Ado.CommitTranAsync(); + Logger.LogError($"【CarryBind】 {input.membercarry_code}成功绑定到{input.carry_code}"); } else { @@ -256,6 +257,8 @@ namespace Tnb.WarehouseMgr } catch (Exception ex) { + Logger.LogError($"【CarryBind】 {ex.Message}"); + Logger.LogError($"【CarryBind】 {ex.StackTrace}"); await _db.Ado.RollbackTranAsync(); return await ToApiResult(JNPF.Common.Enums.HttpStatusCode.InternalServerError, ex.Message); }