bug修复,转库单工位带入二楼任务
This commit is contained in:
@@ -15,9 +15,9 @@
|
|||||||
public string create_id { get; set; }
|
public string create_id { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 料架号
|
/// 工位
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string? carry_code { get; set; }
|
public string? workstation_id { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 终点库位
|
/// 终点库位
|
||||||
|
|||||||
@@ -451,7 +451,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
await _db.Updateable<WmsPretaskH>().SetColumns(r => new WmsPretaskH
|
await _db.Updateable<WmsPretaskH>().SetColumns(r => new WmsPretaskH
|
||||||
{
|
{
|
||||||
note = "WCS上传失败(FAILURE)信号 取消时间:" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
|
note = "WCS上传失败(FAILURE)信号 取消时间:" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
|
||||||
status = WmsWareHouseConst.TASK_BILL_STATUS_CANCEL_ID
|
status = WmsWareHouseConst.PRETASK_BILL_STATUS_CANCEL_ID
|
||||||
}).Where(P => wmsDistaskHCodes.Contains(P.bill_code)).ExecuteCommandAsync();
|
}).Where(P => wmsDistaskHCodes.Contains(P.bill_code)).ExecuteCommandAsync();
|
||||||
Logger.Information("成功处理WCS上传的失败任务");
|
Logger.Information("成功处理WCS上传的失败任务");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -78,6 +78,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
public static SemaphoreSlim s_floor2CreatePretask = new(1);
|
public static SemaphoreSlim s_floor2CreatePretask = new(1);
|
||||||
public SemaphoreSlim s_taskCommonCreatePretask = new(1);
|
public SemaphoreSlim s_taskCommonCreatePretask = new(1);
|
||||||
public SemaphoreSlim s_taskGenPreTask = new(1);
|
public SemaphoreSlim s_taskGenPreTask = new(1);
|
||||||
|
public SemaphoreSlim s_GenTaskExecute = new(1);
|
||||||
|
|
||||||
public Func<string, int, Task> AddUnExecuteTask { get; set; }
|
public Func<string, int, Task> AddUnExecuteTask { get; set; }
|
||||||
|
|
||||||
@@ -773,9 +774,11 @@ namespace Tnb.WarehouseMgr
|
|||||||
rackAreaPointsDown.Add("AX02");
|
rackAreaPointsDown.Add("AX02");
|
||||||
|
|
||||||
try {
|
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();
|
await _db.Ado.BeginTranAsync();
|
||||||
Logger.Information($"【二楼机械臂Floor2MechanicalComplete】收到到货完成信号 传入参数: {disTask.bill_code} {action}");
|
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);
|
ISugarQueryable<WmsMechanicalArmH> WmsMechanicalArmHs = _db.Queryable<WmsMechanicalArmH>().Where(r => r.location_code == disTask.startlocation_code);
|
||||||
if (WmsMechanicalArmHs.Count() == 0)
|
if (WmsMechanicalArmHs.Count() == 0)
|
||||||
{
|
{
|
||||||
Logger.Information($"【二楼机械臂Floor2MechanicalComplete】 任务执行起点{disTask.endpoint_code} 与料架区的点位不匹配");
|
Logger.Information($"【二楼机械臂Floor2MechanicalComplete】 任务执行终点{disTask.endpoint_code} 与料架区的点位不匹配");
|
||||||
throw new Exception($"【二楼机械臂Floor2MechanicalComplete】 任务执行起点{disTask.endpoint_code} 与料架区的点位不匹配");
|
throw new Exception($"【二楼机械臂Floor2MechanicalComplete】 任务执行终点{disTask.endpoint_code} 与料架区的点位不匹配");
|
||||||
}
|
}
|
||||||
WmsMechanicalArmH target = WmsMechanicalArmHs.First();
|
WmsMechanicalArmH target = WmsMechanicalArmHs.First();
|
||||||
|
|
||||||
@@ -886,7 +889,20 @@ namespace Tnb.WarehouseMgr
|
|||||||
|
|
||||||
// 更新料架在二楼配送的目标工位
|
// 更新料架在二楼配送的目标工位
|
||||||
// todo erp工位字段取数位置未确定
|
// 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}");
|
Logger.LogInformation($@"【上升降机】更新料架 {target.rackcode} 在二楼配送的目标工位 {targetWorkstation}");
|
||||||
await _db.Updateable<WmsCarryH>().SetColumns(r => new WmsCarryH
|
await _db.Updateable<WmsCarryH>().SetColumns(r => new WmsCarryH
|
||||||
{
|
{
|
||||||
@@ -954,6 +970,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
//return true;
|
//return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 生成任务执行
|
/// 生成任务执行
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -961,20 +978,19 @@ namespace Tnb.WarehouseMgr
|
|||||||
[HttpPost]
|
[HttpPost]
|
||||||
public async Task GenTaskExecute()
|
public async Task GenTaskExecute()
|
||||||
{
|
{
|
||||||
if (s_taskExecuteSemaphore.CurrentCount == 0)
|
if (s_GenTaskExecute.CurrentCount == 0)
|
||||||
{
|
{
|
||||||
Logger.Information("【GenTaskExecute】 【测试】 丢弃此执行");
|
Logger.Information("【GenTaskExecute】 【测试】 丢弃此执行");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
await s_taskExecuteSemaphore.WaitAsync();
|
await s_GenTaskExecute.WaitAsync();
|
||||||
await CTUTaskExecute();
|
|
||||||
|
|
||||||
Stopwatch sw = Stopwatch.StartNew();
|
Stopwatch sw = Stopwatch.StartNew();
|
||||||
CancellationTokenSource agvCts = new();
|
CancellationTokenSource agvCts = new();
|
||||||
|
|
||||||
SqlSugarClient db = _db.CopyNew();
|
SqlSugarClient db = _db.CopyNew();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
await CTUTaskExecute();
|
||||||
|
|
||||||
//获取所有未下发的预任务申请
|
//获取所有未下发的预任务申请
|
||||||
Logger.Information("【GenTaskExecute】 开始获取未下发的预任务...");
|
Logger.Information("【GenTaskExecute】 开始获取未下发的预任务...");
|
||||||
|
|
||||||
@@ -1101,6 +1117,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Logger.Information($"已生成任务执行编码");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1237,7 +1254,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
_ = s_taskExecuteSemaphore.Release();
|
_ = s_GenTaskExecute.Release();
|
||||||
agvCts.Dispose();
|
agvCts.Dispose();
|
||||||
sw.Stop();
|
sw.Stop();
|
||||||
Logger.Information($"【GenTaskExecute】 任务执行耗时{sw.ElapsedMilliseconds}毫秒");
|
Logger.Information($"【GenTaskExecute】 任务执行耗时{sw.ElapsedMilliseconds}毫秒");
|
||||||
@@ -1503,6 +1520,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
throw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//判断生成bill_code
|
//判断生成bill_code
|
||||||
@@ -1819,10 +1837,10 @@ namespace Tnb.WarehouseMgr
|
|||||||
kiva.Add("ZSSSXCTU01");
|
kiva.Add("ZSSSXCTU01");
|
||||||
List<string> floor2 = new List<string>();
|
List<string> floor2 = new List<string>();
|
||||||
// 二楼暂存仓
|
// 二楼暂存仓
|
||||||
floor2.Add("AS01");
|
//floor2.Add("AS01");
|
||||||
floor2.Add("AS02");
|
//floor2.Add("AS02");
|
||||||
floor2.Add("AX01");
|
//floor2.Add("AX01");
|
||||||
floor2.Add("AX02");
|
//floor2.Add("AX02");
|
||||||
//调用AGV创建任务链接口
|
//调用AGV创建任务链接口
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -1838,7 +1856,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
sourceName = it.startpoint_code,
|
sourceName = it.startpoint_code,
|
||||||
targetName = it.endpoint_code,
|
targetName = it.endpoint_code,
|
||||||
containerCode = it.carry_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)}");
|
Logger.Information($"【AgvDispatch】 Agv任务执行的taskChainCodeDic:{JsonConvert.SerializeObject(taskChainCodeDic)}");
|
||||||
@@ -1848,7 +1866,8 @@ namespace Tnb.WarehouseMgr
|
|||||||
var typeflag = false;
|
var typeflag = false;
|
||||||
var dis = disTasks.Where(p => p.groups == k).First();
|
var dis = disTasks.Where(p => p.groups == k).First();
|
||||||
if (kiva.Contains(dis.startlocation_code) || kiva.Contains(dis.endlocation_code)
|
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;
|
typeflag = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -301,7 +301,10 @@ namespace Tnb.WarehouseMgr
|
|||||||
visualDevModelCrInput.data[nameof(WmsCarrybindH.membercarry_code)] = input.membercarry_code;
|
visualDevModelCrInput.data[nameof(WmsCarrybindH.membercarry_code)] = input.membercarry_code;
|
||||||
visualDevModelCrInput.data[nameof(WmsCarrybindH.type)] = 0;
|
visualDevModelCrInput.data[nameof(WmsCarrybindH.type)] = 0;
|
||||||
visualDevModelCrInput.data[nameof(WmsCarrybindH.carrystd_id)] = carry.carrystd_id;
|
visualDevModelCrInput.data[nameof(WmsCarrybindH.carrystd_id)] = carry.carrystd_id;
|
||||||
|
if (!string.IsNullOrEmpty(input.create_id))
|
||||||
|
{
|
||||||
visualDevModelCrInput.data[nameof(WmsCarrybindH.create_id)] = input.create_id;
|
visualDevModelCrInput.data[nameof(WmsCarrybindH.create_id)] = input.create_id;
|
||||||
|
|
||||||
visualDevModelCrInput.data[nameof(WmsCarrybindH.create_time)] = DateTime.Now;
|
visualDevModelCrInput.data[nameof(WmsCarrybindH.create_time)] = DateTime.Now;
|
||||||
visualDevModelCrInput.data[nameof(WmsCarrybindH.loc)] = 1;
|
visualDevModelCrInput.data[nameof(WmsCarrybindH.loc)] = 1;
|
||||||
VisualDevEntity? templateEntity = await _visualDevService.GetInfoById(ModuleConsts.MODULE_WMSCARRYUNBIND_ID, true);
|
VisualDevEntity? templateEntity = await _visualDevService.GetInfoById(ModuleConsts.MODULE_WMSCARRYUNBIND_ID, true);
|
||||||
|
|||||||
@@ -542,17 +542,23 @@ namespace Tnb.WarehouseMgr
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
WmsCarryH wmsCarryH = _db.Queryable<WmsCarryH>().Where(r => r.carry_code == input.carry_code).First();
|
OrganizeEntity organizeEntity = _db.Queryable<OrganizeEntity>().Where(r => r.Id == input.workstation_id).First();
|
||||||
|
if (organizeEntity == null)
|
||||||
|
{
|
||||||
|
Logger.LogWarning($"【CallRackToProductionLine】不存在工位id为{input.workstation_id}的工位!");
|
||||||
|
throw new AppFriendlyException($"不存在工位id为{input.workstation_id}的工位!", 500);
|
||||||
|
}
|
||||||
|
WmsCarryH wmsCarryH = _db.Queryable<WmsCarryH>().Where(r => r.work_station == organizeEntity.EnCode).First();
|
||||||
if (wmsCarryH == null)
|
if (wmsCarryH == null)
|
||||||
{
|
{
|
||||||
Logger.LogWarning($"【CallRackToProductionLine】不存在编码为{input.carry_code}的料架号!");
|
Logger.LogWarning($"【CallRackToProductionLine】不存在工位为{organizeEntity.EnCode}的料架号!");
|
||||||
throw new AppFriendlyException($"不存在编码为{input.carry_code}的料架号!", 500);
|
throw new AppFriendlyException($"不存在编码为{organizeEntity.EnCode}的料架号!", 500);
|
||||||
}
|
|
||||||
if (string.IsNullOrEmpty(wmsCarryH.work_station))
|
|
||||||
{
|
|
||||||
Logger.LogWarning($"【CallRackToProductionLine】此料架目标工位为空!{input.carry_code}");
|
|
||||||
throw new AppFriendlyException($"此料架目标工位为空!{input.carry_code}!", 500);
|
|
||||||
}
|
}
|
||||||
|
//if (string.IsNullOrEmpty(wmsCarryH.work_station))
|
||||||
|
//{
|
||||||
|
// Logger.LogWarning($"【CallRackToProductionLine】此料架目标工位为空!{input.carry_code}");
|
||||||
|
// throw new AppFriendlyException($"此料架目标工位为空!{input.carry_code}!", 500);
|
||||||
|
//}
|
||||||
|
|
||||||
//if (string.IsNullOrEmpty(wmsCarryH.location_id))
|
//if (string.IsNullOrEmpty(wmsCarryH.location_id))
|
||||||
//{
|
//{
|
||||||
@@ -562,8 +568,8 @@ namespace Tnb.WarehouseMgr
|
|||||||
|
|
||||||
if (string.IsNullOrEmpty(input.endlocation_id))
|
if (string.IsNullOrEmpty(input.endlocation_id))
|
||||||
{
|
{
|
||||||
Logger.LogWarning($"【CallRackToProductionLine】终点库位不能为空!{input.carry_code}");
|
Logger.LogWarning($"【CallRackToProductionLine】终点库位不能为空!{input.endlocation_id}");
|
||||||
throw new AppFriendlyException($"终点库位不能为空!{input.carry_code}", 500);
|
throw new AppFriendlyException($"终点库位不能为空!{input.endlocation_id}", 500);
|
||||||
}
|
}
|
||||||
|
|
||||||
//BasLocation endlocation = _db.Queryable<BasLocation>().Where(r => r.location_code == wmsCarryH.work_station).First();
|
//BasLocation endlocation = _db.Queryable<BasLocation>().Where(r => r.location_code == wmsCarryH.work_station).First();
|
||||||
@@ -571,8 +577,8 @@ namespace Tnb.WarehouseMgr
|
|||||||
WmsPretaskH wmsPretaskH = _db.Queryable<WmsPretaskH>().Where(r => r.carry_code == wmsCarryH.carry_code && r.status != WmsWareHouseConst.PRETASK_BILL_STATUS_COMPLE_ID).First();
|
WmsPretaskH wmsPretaskH = _db.Queryable<WmsPretaskH>().Where(r => r.carry_code == wmsCarryH.carry_code && r.status != WmsWareHouseConst.PRETASK_BILL_STATUS_COMPLE_ID).First();
|
||||||
if (wmsPretaskH != null)
|
if (wmsPretaskH != null)
|
||||||
{
|
{
|
||||||
Logger.LogWarning($"【CallRackToProductionLine】此料架{input.carry_code}存在未完成的预任务{wmsPretaskH.bill_code}!");
|
Logger.LogWarning($"【CallRackToProductionLine】此料架{wmsCarryH.carry_code}存在未完成的预任务{wmsPretaskH.bill_code}!");
|
||||||
throw new AppFriendlyException($"此料架{input.carry_code}存在未完成的预任务{wmsPretaskH.bill_code}!", 500);
|
throw new AppFriendlyException($"此料架{wmsCarryH.carry_code}存在未完成的预任务{wmsPretaskH.bill_code}!", 500);
|
||||||
}
|
}
|
||||||
|
|
||||||
CommonCreatePretaskInput commonCreatePretaskInput = new CommonCreatePretaskInput();
|
CommonCreatePretaskInput commonCreatePretaskInput = new CommonCreatePretaskInput();
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ public class Startup : AppStartup
|
|||||||
services.AddSingleton<BackgroundService, TimedTaskBackgroundService>(sp => new TimedTaskBackgroundService());
|
services.AddSingleton<BackgroundService, TimedTaskBackgroundService>(sp => new TimedTaskBackgroundService());
|
||||||
//var bgSvc = App.GetRequiredService<BackgroundService>();
|
//var bgSvc = App.GetRequiredService<BackgroundService>();
|
||||||
//bgSvc.StartAsync(CancellationToken.None);
|
//bgSvc.StartAsync(CancellationToken.None);
|
||||||
// services.AddHostedService<RedisBackGround>();
|
services.AddHostedService<RedisBackGround>();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user