diff --git a/ProductionMgr/Tnb.ProductionMgr/RedisBackGround.cs b/ProductionMgr/Tnb.ProductionMgr/RedisBackGround.cs index 5e8fb7db..02763a81 100644 --- a/ProductionMgr/Tnb.ProductionMgr/RedisBackGround.cs +++ b/ProductionMgr/Tnb.ProductionMgr/RedisBackGround.cs @@ -518,7 +518,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA if (!result_createPretask) { LoggerBGWCarrySupplement.LogWarning($"【BGWCarrySupplementtimer】 {startLocation.location_code} 到 {endLocation.location_code} 预任务生成失败 "); - continue; + throw new Exception($"【BGWCarrySupplementtimer】 {startLocation.location_code} 到 {endLocation.location_code} 预任务生成失败"); } LoggerBGWCarrySupplement.LogInformation($"【BGWCarrySupplementtimer】 {startLocation.location_code} 到 {endLocation.location_code} 预任务生成成功"); @@ -611,7 +611,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA if (!result_createPretask) { LoggerYCLGLDPJInstock.LogWarning($"【YCLGLDPJInstock】 {startLocation.location_code} 到 {endLocation.location_code} 预任务生成失败"); - continue; + throw new Exception($"【YCLGLDPJInstock】 {startLocation.location_code} 到 {endLocation.location_code} 预任务生成失败"); } LoggerYCLGLDPJInstock.LogWarning($"【YCLGLDPJInstock】 {startLocation.location_code} 到 {endLocation.location_code} 预任务生成成功"); @@ -699,7 +699,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA if (!result_createPretask) { LoggerYCLGLDPJInstock.LogWarning($"【YCLWXDPJInstock】 {startLocation.location_code} 到 {endLocation.location_code} 预任务生成失败"); - continue; + throw new Exception($"【YCLWXDPJInstock】 {startLocation.location_code} 到 {endLocation.location_code} 预任务生成失败"); } LoggerYCLGLDPJInstock.LogWarning($"【YCLWXDPJInstock】 {startLocation.location_code} 到 {endLocation.location_code} 预任务生成成功"); @@ -1190,13 +1190,15 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA .Where((a, b, c, d) => a.wh_id == "33780009364245" && a.is_use == "1" && a.is_lock == 0 && a.is_type == "0" && !string.IsNullOrEmpty(c.id) && b.carrystd_id == WmsWareHouseConst.CARRY_LJSTD_ID).OrderBy((a, b, c, d) => d.id).Select((a, b, c, d) => new // 关联载具物料明细表 { + wmsCarryH = b, basLocation = a, WmsCarryCode_id = d.id }).ToList().GroupBy(r => r.basLocation.location_code).Select(r => { var item = r.FirstOrDefault(); - // 前面通过OrderBy(d => d.id)对WmsCarryCode_id进行了排序 那么如果第一行有数据则说明存在非空料箱 - if (!string.IsNullOrEmpty(item.WmsCarryCode_id)) + // 空载具入库: 前面通过OrderBy(d => d.id)对WmsCarryCode_id进行了排序 那么如果第一行有数据则说明存在非空料箱 + // 没有物料且没有退料标记的不满足出库条件 + if (!string.IsNullOrEmpty(item.WmsCarryCode_id) && (item.wmsCarryH.need_return == 0 || item.wmsCarryH.need_return == null)) { return new BasLocation(); } @@ -1257,11 +1259,16 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA LoggerFloor2RackDelivery.LogInformation($"【送满托到下升降区】 开始生成预任务 起点{startLocation.location_code} 终点{wmsMechanicalArmH.location_code} 料架 {targetCarry.carry_code}"); + await db_Floor2timer送满托到下升降区.Updateable().SetColumns(r => new WmsCarryH + { + need_return = 0 + }).Where(r => r.id == targetCarry.id).ExecuteCommandAsync(); + 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}"); - continue; + throw new Exception($"【送满托到下升降区】 未成功生成预任务 起点{startLocation.location_code} 终点{wmsMechanicalArmH.location_code} 料架 {targetCarry.carry_code}"); } } await db_Floor2timer送满托到下升降区.Ado.CommitTranAsync(); @@ -1473,7 +1480,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA if (!result) { LoggerFloor2RackDelivery.LogInformation($"【移走下升降区空托的料架】 未成功生成预任务 起点{wmsMechanicalArmH.location_code} 终点{endLocation.location_code} 料架 {wmsMechanicalArmH.rackcode}"); - continue; + throw new Exception($"【移走下升降区空托的料架】 未成功生成预任务 起点{wmsMechanicalArmH.location_code} 终点{endLocation.location_code} 料架 {wmsMechanicalArmH.rackcode}"); } } await db_Floor2timer移走下升降区未生成预任务且空托的料架.Ado.CommitTranAsync(); diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Consts/ModuleConsts.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Consts/ModuleConsts.cs index 0486c45f..97161545 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Consts/ModuleConsts.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Consts/ModuleConsts.cs @@ -227,7 +227,7 @@ public class ModuleConsts /// /// 模块标识-原材料转库单 /// - public const string MODULE_WMSMATERIALTRANSFER_ID = "34354738929685"; + public const string MODULE_WMSMATERIALTRANSFER_ID = "35129233455125"; /// /// 模块标识-生产入库单 /// diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsCarryH.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsCarryH.cs index c83331eb..f4725c05 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsCarryH.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsCarryH.cs @@ -139,5 +139,10 @@ public partial class WmsCarryH : BaseEntity /// 配送工位 /// public string? work_station { get; set; } + + /// + /// 需要退料 + /// + public int need_return { get; set; } } diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs index 1079447b..c963fce4 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs @@ -2098,7 +2098,7 @@ namespace Tnb.WarehouseMgr { id = multiList[i].endlocation_id, is_lock = 0, - is_use = multiList[i].carry_status + is_use = string.IsNullOrEmpty(multiList[i].carry_status) ? ((int)EnumCarryStatus.占用).ToString() : multiList[i].carry_status }; if (!string.IsNullOrEmpty(multiList[i].carry_status) && multiList[i].carry_status.ToEnum() == EnumCarryStatus.空闲) { @@ -2119,6 +2119,7 @@ namespace Tnb.WarehouseMgr _ = await _db.Updateable(carryCodeIts).UpdateColumns(it => new { it.warehouse_id, it.location_id, it.location_code }).Where(it => multiList.Select(x => x.carry_id).Contains(it.carry_id)).ExecuteCommandAsync(); //更新库位信息,使用状态为 使用,锁定状态为未锁定 _ = await _db.Updateable(locIts).UpdateColumns(it => new { it.is_use, it.is_lock }).ExecuteCommandAsync(); + Logger.Information($"【TaskComplate】 更新库位 {JsonConvert.SerializeObject(locIts)}"); /* var loginType= _userManager?.LoginType ?? "web"; Log.Information($"_userManager.LoginType={loginType}"); */ //更新业务主表的单据状态 @@ -2151,11 +2152,13 @@ namespace Tnb.WarehouseMgr // 二楼物料呼叫任务结束后清空工位信息 else if (dt.biz_type == "FloorCallMaterial") { - await _db.Updateable().SetColumns(r => r.work_station == "").Where(r => r.id == dt.carry_id).ExecuteCommandAsync(); + await _db.Updateable().SetColumns(r => new WmsCarryH + { + work_station = "" + }).Where(r => r.id == dt.carry_id).ExecuteCommandAsync(); // require_code是任务单 //string mo_task_code = dt.require_code; - } #endregion @@ -2971,7 +2974,7 @@ namespace Tnb.WarehouseMgr } else { - throw new AppFriendlyException("生成预任务失败", 500); + throw new AppFriendlyException("生成预任务失败(可能是因为预任务起点与终点相同)", 500); } } catch (Exception ex) diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPrdReturnService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPrdReturnService.cs index a1d69bb7..8feaa721 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPrdReturnService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPrdReturnService.cs @@ -169,6 +169,9 @@ namespace Tnb.WarehouseMgr await _db.Ado.BeginTranAsync(); + // 标记为退料 + await _db.Updateable().SetColumns(r => r.need_return == 1).Where(r => r.id == wmsCarryH.id).ExecuteCommandAsync(); + Logger.LogWarning($"【PrdReturn】开始生成预任务"); CommonCreatePretaskInput commonCreatePretaskInput = new(); commonCreatePretaskInput.startlocation_id = startlocation.id; @@ -268,6 +271,8 @@ namespace Tnb.WarehouseMgr } await _db.Ado.BeginTranAsync(); + // 标记为退料 + await _db.Updateable().SetColumns(r => r.need_return == 1).Where(r => r.id == wmsCarryH.id).ExecuteCommandAsync(); Logger.LogWarning($"【PrdReturn】开始生成预任务"); CommonCreatePretaskInput commonCreatePretaskInput = new();