三楼人工库逻辑等
This commit is contained in:
@@ -2337,7 +2337,7 @@ namespace Tnb.WarehouseMgr
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception($"通知WCS电梯{devName}下行接口调用成功");
|
||||
Logger.Information($"通知WCS电梯{devName}下行接口调用成功");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3100,21 +3100,42 @@ namespace Tnb.WarehouseMgr
|
||||
{
|
||||
WmsElevatorH wmsElevatorH = await _db.Queryable<WmsElevatorH>().Where(it => it.elevator_group == "2" && it.enabled == 1).OrderBy(r => r.task_nums).FirstAsync();
|
||||
string elevatorSno = wmsElevatorH.elevator_code.Replace("Elevator", "");
|
||||
|
||||
List<BasLocation> locations = await _db.Queryable<BasLocation>()
|
||||
.InnerJoin<WmsPointH>((a, b) => a.id == b.location_id)
|
||||
.InnerJoin<WmsPointD>((a, b, c) => b.id == c.point_id)
|
||||
.InnerJoin<WmsPointH>((a, b, c, d) => d.id == c.endpoint_id)
|
||||
.Where((a, b, c, d) => a.wh_id == WmsWareHouseConst.WAREHOUSE_CP_ID && a.region_id == WmsWareHouseConst.REGION_CPOutstockCache_ID && d.point_code == $"DT-3-{elevatorSno}")
|
||||
.Where((a, b, c, d) => a.wh_id == WmsWareHouseConst.WAREHOUSE_CP_ID
|
||||
&& a.is_lock == 0 && a.is_use == "0"
|
||||
&& a.region_id == WmsWareHouseConst.REGION_CPOutstockCache_ID && d.point_code == $"DT-3-{elevatorSno}")
|
||||
.Select((a, b, c, d) => new BasLocation
|
||||
{
|
||||
location_code = a.location_code,
|
||||
extras = d.point_code
|
||||
}).OrderBy("a.is_lock, a.is_use, a.location_code, d.point_code").ToListAsync();
|
||||
}).OrderBy("a.location_code, d.point_code").ToListAsync();
|
||||
// 如果没有空闲库位 再找一下另一个电梯的缓存区有没有空闲库位
|
||||
if (locations.Count == 0)
|
||||
{
|
||||
elevatorSno = elevatorSno == "3" ? "4" : "3";
|
||||
locations = await _db.Queryable<BasLocation>()
|
||||
.InnerJoin<WmsPointH>((a, b) => a.id == b.location_id)
|
||||
.InnerJoin<WmsPointD>((a, b, c) => b.id == c.point_id)
|
||||
.InnerJoin<WmsPointH>((a, b, c, d) => d.id == c.endpoint_id)
|
||||
.Where((a, b, c, d) => a.wh_id == WmsWareHouseConst.WAREHOUSE_CP_ID
|
||||
&& a.is_lock == 0 && a.is_use == "0"
|
||||
&& a.region_id == WmsWareHouseConst.REGION_CPOutstockCache_ID && d.point_code == $"DT-3-{elevatorSno}")
|
||||
.Select((a, b, c, d) => new BasLocation
|
||||
{
|
||||
location_code = a.location_code,
|
||||
extras = d.point_code
|
||||
}).OrderBy("a.location_code, d.point_code").ToListAsync();
|
||||
}
|
||||
|
||||
if (locations.Count == 0)
|
||||
{
|
||||
throw new AppFriendlyException($"三楼发货时,没有可用的暂存库位可以使用", 500);
|
||||
}
|
||||
|
||||
BasLocation cache_location = locations.First();
|
||||
// 到暂存区
|
||||
points.Add(wmsPointHs.Where(r => r.id == pStartId).First());
|
||||
@@ -4055,6 +4076,79 @@ namespace Tnb.WarehouseMgr
|
||||
}
|
||||
}
|
||||
|
||||
public SemaphoreSlim GetSemaphore(string type, string warehouse_id, string region_id = "")
|
||||
{
|
||||
SemaphoreSlim result = null;
|
||||
switch (warehouse_id)
|
||||
{
|
||||
case WmsWareHouseConst.WAREHOUSE_ZC_ID:
|
||||
{
|
||||
if (type == "outstock")
|
||||
result = _s_taskExecuteSemaphore_F1ZCCOutstock;
|
||||
else if (type == "instock")
|
||||
result = _s_taskExecuteSemaphore_F1ZCCInstock;
|
||||
break;
|
||||
}
|
||||
case WmsWareHouseConst.WAREHOUSE_HCC_ID:
|
||||
{
|
||||
if (type == "outstock")
|
||||
result = _s_taskExecuteSemaphore_F2HCCOutstock;
|
||||
else if (type == "instock")
|
||||
result = _s_taskExecuteSemaphore_F2HCCInstock;
|
||||
|
||||
break;
|
||||
}
|
||||
case WmsWareHouseConst.WAREHOUSE_YCL_ID:
|
||||
{
|
||||
if (type == "outstock")
|
||||
result = _s_taskExecuteSemaphore_YCLOutstock;
|
||||
else if (type == "instock")
|
||||
result = _s_taskExecuteSemaphore_YCLInstock;
|
||||
break;
|
||||
}
|
||||
case WmsWareHouseConst.WAREHOUSE_CP_ID:
|
||||
{
|
||||
if (type == "outstock")
|
||||
result = _s_taskExecuteSemaphore_F3CPOutstock;
|
||||
else if (type == "instock")
|
||||
result = _s_taskExecuteSemaphore_F3CPInstock;
|
||||
break;
|
||||
}
|
||||
case WmsWareHouseConst.WAREHOUSE_ZCC_ID:
|
||||
{
|
||||
if (type == "outstock")
|
||||
result = _s_taskExecuteSemaphore_F2ZCCOutstock;
|
||||
else if (type == "instock")
|
||||
result = _s_taskExecuteSemaphore_F2ZCCInstock;
|
||||
break;
|
||||
}
|
||||
case WmsWareHouseConst.WAREHOUSE_DMJC_ID:
|
||||
{
|
||||
if (type == "outstock")
|
||||
result = _s_taskExecuteSemaphore_F4DMJCOutstock;
|
||||
else if (type == "instock")
|
||||
result = _s_taskExecuteSemaphore_F4DMJCInstock;
|
||||
break;
|
||||
}
|
||||
case WmsWareHouseConst.WAREHOUSE_BCK_ID:
|
||||
{
|
||||
if (type == "outstock")
|
||||
result = _s_taskExecuteSemaphore_F4BCKOutstock;
|
||||
else if (type == "instock")
|
||||
result = _s_taskExecuteSemaphore_F4BCKInstock;
|
||||
break;
|
||||
}
|
||||
case WmsWareHouseConst.WAREHOUSE_F2BCQ_ID:
|
||||
{
|
||||
if (type == "outstock")
|
||||
result = _s_taskExecuteSemaphore_F2BCQOutstock;
|
||||
else if (type == "instock")
|
||||
result = _s_taskExecuteSemaphore_F2BCQInstock;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return _s_taskExecuteSemaphore_F1ZCCOutstock;
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user