库位载具数,灭菌入库单号

This commit is contained in:
2024-09-03 16:23:52 +08:00
parent 9f1806e852
commit df654b1523
5 changed files with 24 additions and 14 deletions

View File

@@ -134,4 +134,8 @@ public partial class BasLocation : BaseEntity<string>
/// 通道
/// </summary>
public string passage { get; set; }
/// <summary>
/// 载具数量
/// </summary>
public int carry_count { get; set; }
}

View File

@@ -89,4 +89,9 @@ public partial class WmsSterilizationInstockH : BaseEntity<string>
/// </summary>
public string? status { get; set; }
/// <summary>
/// 单号
/// </summary>
public string? bill_code { get; set; }
}

View File

@@ -799,7 +799,6 @@ namespace Tnb.WarehouseMgr
List<WmsDistaskH> disTasks = new() { disTask };
if (input.action == "LOAD")
{
TaskExecuteAfterUpInput taskExecuteAfterUpInput = new()
{
disTaskIds = disTasks.Select(x => x.id).ToList()

View File

@@ -2637,7 +2637,7 @@ namespace Tnb.WarehouseMgr
if (carryAndLocIds?.Count > 0)
{
List<string> startLocationIds = carryAndLocIds.Select(x => x.startlocation_id).ToList();
_ = await db.Updateable<BasLocation>().SetColumns(it => new BasLocation { is_use = ((int)EnumCarryStatus.).ToString(), is_lock = 0 }).Where(it => startLocationIds.Contains(it.id)).ExecuteCommandAsync();
_ = await db.Updateable<BasLocation>().SetColumns(it => new BasLocation { is_use = ((int)EnumCarryStatus.).ToString(), is_lock = 0, carry_count = it.carry_count - 1 }).Where(it => startLocationIds.Contains(it.id)).ExecuteCommandAsync();
}
List<WmsDistaskH> disTasks = db.Queryable<WmsDistaskH>().Where(r => input.disTaskIds.Contains(r.id)).ToList();
@@ -2755,6 +2755,7 @@ namespace Tnb.WarehouseMgr
List<(string carry_id, string carry_status, string endlocation_id, string endlocation_code)> multiList = disTasks.Select(it => (it.carry_id, it.carry_status, it.endlocation_id, it.endlocation_code)).ToList();
Dictionary<string, object> locWhIdMap = await db.Queryable<BasLocation>().Where(it => multiList.Select(x => x.endlocation_id).Contains(it.id)).ToDictionaryAsync(it => it.id, it => it.wh_id);
Dictionary<string, object> locTypeMap = await db.Queryable<BasLocation>().Where(it => multiList.Select(x => x.endlocation_id).Contains(it.id)).ToDictionaryAsync(it => it.id, it => it.is_type);
Dictionary<string, object> locCarrycountMap = await db.Queryable<BasLocation>().Where(it => multiList.Select(x => x.endlocation_id).Contains(it.id)).ToDictionaryAsync(it => it.id, it => it.carry_count);
List<WmsCarryH> carryIts = new();
List<WmsCarryCode> carryCodeIts = new();
List<BasLocation> locIts = new();
@@ -2801,6 +2802,7 @@ namespace Tnb.WarehouseMgr
{
id = multiList[i].endlocation_id,
is_lock = 0,
carry_count = locCarrycountMap[endLocId] == null ? 1: int.Parse(locCarrycountMap[endLocId].ToString()) + 1,
is_use = string.IsNullOrEmpty(multiList[i].carry_status) ? ((int)EnumCarryStatus.).ToString() : multiList[i].carry_status
};
if (!string.IsNullOrEmpty(multiList[i].carry_status))
@@ -2823,7 +2825,7 @@ namespace Tnb.WarehouseMgr
//更新条码的库位和仓库信息
_ = await db.Updateable(carryCodeIts).UpdateColumns(it => new { it.warehouse_id, it.location_id, it.location_code }).ExecuteCommandAsync();
//更新库位信息,使用状态为 使用,锁定状态为未锁定
_ = await db.Updateable(locIts).UpdateColumns(it => new { it.is_use, it.is_lock }).ExecuteCommandAsync();
_ = await db.Updateable(locIts).UpdateColumns(it => new { it.is_use, it.is_lock, it.carry_count }).ExecuteCommandAsync();
Logger.Information($"【TaskComplate】 更新库位 {JsonConvert.SerializeObject(locIts)}");
/* var loginType= _userManager?.LoginType ?? "web";
Log.Information($"_userManager.LoginType={loginType}");

View File

@@ -183,19 +183,19 @@ namespace Tnb.WarehouseMgr
// 自动发货
if (!input.isManual)
{
endLocations = await _db.Queryable<BasLocation>().Where(r => _wareHouseService.GetFloor1OutstockLocation().Contains(r.id) && r.is_lock == 0 && r.is_use == "0").ToListAsync();
//endLocations = await _db.Queryable<BasLocation>().Where(r => _wareHouseService.GetFloor1OutstockLocation().Contains(r.id) && r.is_lock == 0 && r.is_use == "0").ToListAsync();
if (endLocations.Count < items_pretask.Count)
{
throw new AppFriendlyException("一楼没有足够的未锁定且空闲的出库工位", 500);
}
//if (endLocations.Count < items_pretask.Count)
//{
// throw new AppFriendlyException("一楼没有足够的未锁定且空闲的出库工位", 500);
//}
List<BasLocation> endLocations_temp = await _db.Queryable<BasLocation>().Where(r => r.region_id == WmsWareHouseConst.REGION_CPOutstockCache_ID && r.is_lock == 0 && r.is_use == "0").ToListAsync();
//List<BasLocation> endLocations_temp = await _db.Queryable<BasLocation>().Where(r => r.region_id == WmsWareHouseConst.REGION_CPOutstockCache_ID && r.is_lock == 0 && r.is_use == "0").ToListAsync();
if (endLocations_temp.Count < items_pretask.Count)
{
throw new AppFriendlyException($"三楼发货时,没有可用的暂存库位可以使用,需要下发任务{items_pretask.Count}条,可用的暂存库位只有{endLocations_temp.Count}条", 500);
}
//if (endLocations_temp.Count < items_pretask.Count)
//{
// throw new AppFriendlyException($"三楼发货时,没有可用的暂存库位可以使用,需要下发任务{items_pretask.Count}条,可用的暂存库位只有{endLocations_temp.Count}条", 500);
//}
}
//人工发货
else
@@ -232,7 +232,7 @@ namespace Tnb.WarehouseMgr
}
List<BasLocation> locations = await _db.Queryable<BasLocation>()
.InnerJoin<WmsElevatorcacheArea>((a, b) => a.id == b.location_id)
.Where((a, b) => b.name == YCLInnerTransfer.value).OrderBy("a.location_code,a.is_lock,a.is_use,task_nums").ToListAsync();
.Where((a, b) => b.name == YCLInnerTransfer.value).OrderBy("a.is_lock,a.is_use,carry_count,a.location_code").ToListAsync();
endLocation = locations.FirstOrDefault();