diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/OutsourcedPartsInstockInput.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/OutsourcedPartsInstockInput.cs index a954b603..6df2f9ad 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/OutsourcedPartsInstockInput.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/OutsourcedPartsInstockInput.cs @@ -22,6 +22,10 @@ /// public string? startlocation_id { get; set; } /// + /// 起点code + /// + public string? startlocation_code { get; set; } + /// /// 需求单据 /// public string? source_id { get; set; } diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDACarryBindService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDACarryBindService.cs index 85e33fb6..23e4931d 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDACarryBindService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDACarryBindService.cs @@ -186,11 +186,15 @@ namespace Tnb.WarehouseMgr { throw new AppFriendlyException("成品调拨明细id不可为空", 500); } - if (string.IsNullOrEmpty(input.startlocation_id)) + if (string.IsNullOrEmpty(input.startlocation_code)) { throw new AppFriendlyException("起点不可为空", 500); } + var baseLocation = await _db.Queryable().Where(r => r.location_code == input.startlocation_code).FirstAsync(); + if (baseLocation == null) + throw new AppFriendlyException($"未找到编号{input.startlocation_code}的库位", 500); + WmsTransferInstockD wmsTransferInstockD = await _db.Queryable().Where(r => r.id == input.source_id).FirstAsync(); if (wmsTransferInstockD.status == WmsWareHouseConst.TASK_BILL_STATUS_COMPLE_ID) { @@ -208,7 +212,7 @@ namespace Tnb.WarehouseMgr WmsPointH sPoint = null!; WmsPointH ePoint = null!; - sPoint = await _db.Queryable().FirstAsync(it => it.location_id == input.startlocation_id); + sPoint = await _db.Queryable().FirstAsync(it => it.location_id == baseLocation.id); if (endLocations?.Count > 0) { WmsCarryH carry = await _db.Queryable().SingleAsync(it => it.carry_code == input.carry_code); @@ -303,20 +307,20 @@ namespace Tnb.WarehouseMgr if (endLocationId != null) { //查询库位表 - BasLocation location = await _db.Queryable().SingleAsync(it => it.id == input.startlocation_id); + BasLocation location = await _db.Queryable().SingleAsync(it => it.id == baseLocation.id); { //载具加锁,增加库位信息 _ = await _db.Updateable().SetColumns(it => new WmsCarryH { carry_status = ((int)EnumCarryStatus.占用).ToString(), is_lock = 1, - location_id = input.startlocation_id, + location_id = baseLocation.id, location_code = location.location_code }).Where(it => it.id == wmsCarryH.id).ExecuteCommandAsync(); } //所有库位加锁 - string?[] ids = new[] { input.startlocation_id, endLocationId }; + string?[] ids = new[] { baseLocation.id, endLocationId }; _ = await _db.Updateable().SetColumns(it => new BasLocation { is_lock = 1 }).Where(it => ids.Contains(it.id)).ExecuteCommandAsync(); BasMaterial basMaterial = await _db.Queryable().FirstAsync(it => it.id == input.material_id);