bug修复,转库单工位带入二楼任务
This commit is contained in:
@@ -78,7 +78,8 @@ namespace Tnb.WarehouseMgr
|
||||
public static SemaphoreSlim s_floor2CreatePretask = new(1);
|
||||
public SemaphoreSlim s_taskCommonCreatePretask = new(1);
|
||||
public SemaphoreSlim s_taskGenPreTask = new(1);
|
||||
|
||||
public SemaphoreSlim s_GenTaskExecute = new(1);
|
||||
|
||||
public Func<string, int, Task> AddUnExecuteTask { get; set; }
|
||||
|
||||
|
||||
@@ -773,9 +774,11 @@ namespace Tnb.WarehouseMgr
|
||||
rackAreaPointsDown.Add("AX02");
|
||||
|
||||
try {
|
||||
List<BasLocation> basLocations = _db.Queryable<BasLocation>().Where(r => (r.location_code == disTask.endlocation_code || r.location_code == disTask.startlocation_code)
|
||||
&& r.wh_id != "33780009364245").ToList();
|
||||
|
||||
|
||||
if (disTask.area_code == "E")
|
||||
// 暂存仓内任务
|
||||
if (disTask.area_code == "E" && basLocations.Count() == 0)
|
||||
{
|
||||
await _db.Ado.BeginTranAsync();
|
||||
Logger.Information($"【二楼机械臂Floor2MechanicalComplete】收到到货完成信号 传入参数: {disTask.bill_code} {action}");
|
||||
@@ -870,8 +873,8 @@ namespace Tnb.WarehouseMgr
|
||||
ISugarQueryable<WmsMechanicalArmH> WmsMechanicalArmHs = _db.Queryable<WmsMechanicalArmH>().Where(r => r.location_code == disTask.startlocation_code);
|
||||
if (WmsMechanicalArmHs.Count() == 0)
|
||||
{
|
||||
Logger.Information($"【二楼机械臂Floor2MechanicalComplete】 任务执行起点{disTask.endpoint_code} 与料架区的点位不匹配");
|
||||
throw new Exception($"【二楼机械臂Floor2MechanicalComplete】 任务执行起点{disTask.endpoint_code} 与料架区的点位不匹配");
|
||||
Logger.Information($"【二楼机械臂Floor2MechanicalComplete】 任务执行终点{disTask.endpoint_code} 与料架区的点位不匹配");
|
||||
throw new Exception($"【二楼机械臂Floor2MechanicalComplete】 任务执行终点{disTask.endpoint_code} 与料架区的点位不匹配");
|
||||
}
|
||||
WmsMechanicalArmH target = WmsMechanicalArmHs.First();
|
||||
|
||||
@@ -886,7 +889,20 @@ namespace Tnb.WarehouseMgr
|
||||
|
||||
// 更新料架在二楼配送的目标工位
|
||||
// todo erp工位字段取数位置未确定
|
||||
string targetWorkstation = "003-01-01-01";
|
||||
WmsMaterialTransferD wmsMaterialTransferD = await _db.Queryable<WmsMaterialTransfer>()
|
||||
.LeftJoin<WmsMaterialTransferD>((a, b) => a.id == b.bill_id).Where((a, b) => a.bill_code == target.outbill)
|
||||
.Select((a, b) => b).FirstAsync();
|
||||
if (wmsMaterialTransferD == null)
|
||||
{
|
||||
throw new Exception($@"【上升降机】 发生异常!,转库单{target.outbill}没有载具明细");
|
||||
}
|
||||
|
||||
string targetWorkstation = wmsMaterialTransferD.station_code;
|
||||
if (string.IsNullOrEmpty(wmsMaterialTransferD.station_code))
|
||||
{
|
||||
throw new Exception($@"【上升降机】 发生异常!,转库单{target.outbill}的工位为空");
|
||||
}
|
||||
|
||||
Logger.LogInformation($@"【上升降机】更新料架 {target.rackcode} 在二楼配送的目标工位 {targetWorkstation}");
|
||||
await _db.Updateable<WmsCarryH>().SetColumns(r => new WmsCarryH
|
||||
{
|
||||
@@ -954,6 +970,7 @@ namespace Tnb.WarehouseMgr
|
||||
//return true;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 生成任务执行
|
||||
/// </summary>
|
||||
@@ -961,20 +978,19 @@ namespace Tnb.WarehouseMgr
|
||||
[HttpPost]
|
||||
public async Task GenTaskExecute()
|
||||
{
|
||||
if (s_taskExecuteSemaphore.CurrentCount == 0)
|
||||
if (s_GenTaskExecute.CurrentCount == 0)
|
||||
{
|
||||
Logger.Information("【GenTaskExecute】 【测试】 丢弃此执行");
|
||||
return;
|
||||
}
|
||||
await s_taskExecuteSemaphore.WaitAsync();
|
||||
await CTUTaskExecute();
|
||||
|
||||
await s_GenTaskExecute.WaitAsync();
|
||||
Stopwatch sw = Stopwatch.StartNew();
|
||||
CancellationTokenSource agvCts = new();
|
||||
|
||||
SqlSugarClient db = _db.CopyNew();
|
||||
try
|
||||
{
|
||||
await CTUTaskExecute();
|
||||
|
||||
//获取所有未下发的预任务申请
|
||||
Logger.Information("【GenTaskExecute】 开始获取未下发的预任务...");
|
||||
|
||||
@@ -1101,6 +1117,7 @@ namespace Tnb.WarehouseMgr
|
||||
}
|
||||
}
|
||||
}
|
||||
Logger.Information($"已生成任务执行编码");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1237,7 +1254,7 @@ namespace Tnb.WarehouseMgr
|
||||
}
|
||||
finally
|
||||
{
|
||||
_ = s_taskExecuteSemaphore.Release();
|
||||
_ = s_GenTaskExecute.Release();
|
||||
agvCts.Dispose();
|
||||
sw.Stop();
|
||||
Logger.Information($"【GenTaskExecute】 任务执行耗时{sw.ElapsedMilliseconds}毫秒");
|
||||
@@ -1503,6 +1520,7 @@ namespace Tnb.WarehouseMgr
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
//判断生成bill_code
|
||||
@@ -1819,10 +1837,10 @@ namespace Tnb.WarehouseMgr
|
||||
kiva.Add("ZSSSXCTU01");
|
||||
List<string> floor2 = new List<string>();
|
||||
// 二楼暂存仓
|
||||
floor2.Add("AS01");
|
||||
floor2.Add("AS02");
|
||||
floor2.Add("AX01");
|
||||
floor2.Add("AX02");
|
||||
//floor2.Add("AS01");
|
||||
//floor2.Add("AS02");
|
||||
//floor2.Add("AX01");
|
||||
//floor2.Add("AX02");
|
||||
//调用AGV创建任务链接口
|
||||
try
|
||||
{
|
||||
@@ -1838,7 +1856,7 @@ namespace Tnb.WarehouseMgr
|
||||
sourceName = it.startpoint_code,
|
||||
targetName = it.endpoint_code,
|
||||
containerCode = it.carry_code,
|
||||
shelfNumber = floor2.Contains(it.startlocation_code) || floor2.Contains(it.endlocation_code) ? it.carry_code : "" // 二楼暂存仓传料架
|
||||
shelfNumber = it.area_code == "E" ? it.carry_code : "" // 二楼暂存仓传料架
|
||||
}));
|
||||
|
||||
Logger.Information($"【AgvDispatch】 Agv任务执行的taskChainCodeDic:{JsonConvert.SerializeObject(taskChainCodeDic)}");
|
||||
@@ -1848,7 +1866,8 @@ namespace Tnb.WarehouseMgr
|
||||
var typeflag = false;
|
||||
var dis = disTasks.Where(p => p.groups == k).First();
|
||||
if (kiva.Contains(dis.startlocation_code) || kiva.Contains(dis.endlocation_code)
|
||||
|| floor2.Contains(dis.startlocation_code) || floor2.Contains(dis.endlocation_code))
|
||||
//|| floor2.Contains(dis.startlocation_code) || floor2.Contains(dis.endlocation_code)
|
||||
)
|
||||
{
|
||||
typeflag = true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user