1、调整电梯逻辑代码
2、新增内部测试类
This commit is contained in:
@@ -82,11 +82,17 @@ namespace Tnb.WarehouseMgr
|
||||
[HttpPost, NonUnify, AllowAnonymous]
|
||||
public async Task<Result> LoadConfirm(ConfirmInput input)
|
||||
{
|
||||
Log.Information("取货确认..................");
|
||||
Logger.Information("--------------------------------------------------------");
|
||||
Logger.Information("取货确认..................");
|
||||
var whereExp = Expressionable.Create<WmsElevatorH, WmsElevatorD, WmsDistaskH>()
|
||||
.And((a, b, c) => c.bill_code == input.taskCode)
|
||||
.AndIF(SqlFunc.Contains("DT-R", input.sourceName), (a, b, c) => c.startpoint_code == input.sourceName)
|
||||
.AndIF(SqlFunc.Contains("DT-C", input.sourceName), (a, b, c) => c.endlocation_code == input.sourceName)
|
||||
.ToExpression();
|
||||
|
||||
WmsElevatorH elevator = await _db.Queryable<WmsElevatorH>().LeftJoin<WmsElevatorD>((a, b) => a.id == b.bill_id)
|
||||
.LeftJoin<WmsDistaskH>((a, b, c) => b.location_id == c.startlocation_id)
|
||||
.Where((a, b, c) => c.endpoint_code == input.sourceName && input.taskCode == input.taskCode)
|
||||
WmsElevatorH elevator = await _db.Queryable<WmsElevatorH>().InnerJoin<WmsElevatorD>((a, b) => a.id == b.bill_id)
|
||||
.InnerJoin<WmsDistaskH>((a, b, c) => b.location_id == c.startlocation_id)
|
||||
.Where(whereExp)
|
||||
.Select((a, b, c) => new WmsElevatorH
|
||||
{
|
||||
distask_id = c.id,
|
||||
@@ -132,6 +138,7 @@ namespace Tnb.WarehouseMgr
|
||||
throw;
|
||||
}
|
||||
return await ToApiResult(HttpStatusCode.OK, "未启用");
|
||||
Logger.Information("--------------------------------------------------------");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -142,14 +149,21 @@ namespace Tnb.WarehouseMgr
|
||||
[HttpPost, NonUnify, AllowAnonymous]
|
||||
public async Task<Result> UnloadConfirm(ConfirmInput input)//
|
||||
{
|
||||
Logger.Information($"输入参数:{JsonConvert.SerializeObject(input)}");
|
||||
Logger.Information("--------------------------------------------------------");
|
||||
Logger.Information("放货确认..................");
|
||||
Logger.Information($"输入参数:{JsonConvert.SerializeObject(input)}");
|
||||
try
|
||||
{
|
||||
var whereExp = Expressionable.Create<WmsElevatorH, WmsElevatorD, WmsDistaskH>()
|
||||
.And((a, b, c) => c.bill_code == input.taskCode)
|
||||
.AndIF(SqlFunc.Contains("DT-R", input.sourceName), (a, b, c) => c.startpoint_code == input.sourceName)
|
||||
.AndIF(SqlFunc.Contains("DT-C", input.sourceName), (a, b, c) => c.endlocation_code == input.sourceName)
|
||||
.ToExpression();
|
||||
|
||||
//根据Agv传递的参数获取,对应的电梯
|
||||
WmsElevatorH elevator = await _db.Queryable<WmsElevatorH>().LeftJoin<WmsElevatorD>((a, b) => a.id == b.bill_id)
|
||||
.LeftJoin<WmsDistaskH>((a, b, c) => b.location_id == c.endlocation_id)
|
||||
.Where((a, b, c) => c.endpoint_code == input.targetName && (c.bill_code == input.taskCode || c.bill_code == input.taskChainCode))
|
||||
.Where(whereExp)
|
||||
.Select((a, b, c) => new WmsElevatorH
|
||||
{
|
||||
end_floor = SqlFunc.ToInt32(c.end_floor),
|
||||
@@ -201,7 +215,7 @@ namespace Tnb.WarehouseMgr
|
||||
}
|
||||
|
||||
return await ToApiResult(HttpStatusCode.InternalServerError, "电梯还未开门,请重试!");
|
||||
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -209,6 +223,7 @@ namespace Tnb.WarehouseMgr
|
||||
return await ToApiResult(HttpStatusCode.InternalServerError, "电梯还未开门,请重试!");
|
||||
throw;
|
||||
}
|
||||
Logger.Information("--------------------------------------------------------");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -218,6 +233,8 @@ namespace Tnb.WarehouseMgr
|
||||
[HttpPost, NonUnify, AllowAnonymous]
|
||||
public async Task<Result> TaskChainCallBack(TaskChainCallBackInput input)
|
||||
{
|
||||
Logger.Information("--------------------------------------------------------");
|
||||
|
||||
try
|
||||
{
|
||||
Logger.Information($"任务链上报->任务链编号:{input.taskChainCode},状态:{input.status},设备ID:{input.deviceID}");
|
||||
@@ -254,7 +271,7 @@ namespace Tnb.WarehouseMgr
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*ConnectionConfigOptions opts = App.GetOptions<ConnectionConfigOptions>();
|
||||
@@ -281,7 +298,10 @@ namespace Tnb.WarehouseMgr
|
||||
return await ToApiResult(HttpStatusCode.InternalServerError, "请重试!");
|
||||
throw;
|
||||
}
|
||||
Logger.Information("--------------------------------------------------------");
|
||||
return await ToApiResult(HttpStatusCode.OK, "成功");
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -292,7 +312,9 @@ namespace Tnb.WarehouseMgr
|
||||
[HttpPost, NonUnify, AllowAnonymous]
|
||||
public async Task<Result> TaskCallback(TaskCallBackInput input)
|
||||
{
|
||||
Log.Information($"任务状态上报->接收参数:{JsonConvert.SerializeObject(input)}");
|
||||
Logger.Information("--------------------------------------------------------");
|
||||
|
||||
Logger.Information($"任务状态上报->接收参数:{JsonConvert.SerializeObject(input)}");
|
||||
try
|
||||
{
|
||||
|
||||
@@ -305,6 +327,7 @@ namespace Tnb.WarehouseMgr
|
||||
{
|
||||
disTaskIds = disTasks.Select(x => x.id).ToList()
|
||||
};
|
||||
|
||||
Logger.Information($"设备取返回输入参数:{JsonConvert.SerializeObject(taskExecuteAfterUpInput)}");
|
||||
await _wareHouseService.TaskExecuteAfter(taskExecuteAfterUpInput);
|
||||
Logger.Information($"Agv取货完成,任务Id:{string.Join(",", disTasks.Select(x => x.id))}");
|
||||
@@ -312,8 +335,11 @@ namespace Tnb.WarehouseMgr
|
||||
if (elevatorQueueItem != null)
|
||||
{
|
||||
Logger.Information("开始进入关门流程");
|
||||
var disTask = disTasks.Find(x => x.id == elevatorQueueItem.distask_id);
|
||||
int doorStatus = await _elevatorControlService.GetTagAsync(elevatorQueueItem.elevator_code, ElevatorConsts.DoorStatus);
|
||||
if (doorStatus.ToEnum<EnumDoorStatus>() != EnumDoorStatus.关门到位保持)
|
||||
if (doorStatus.ToEnum<EnumDoorStatus>() != EnumDoorStatus.关门到位保持
|
||||
&& !disTask.endlocation_code.StartsWith("DT", StringComparison.OrdinalIgnoreCase)
|
||||
)
|
||||
{
|
||||
_ = await _elevatorControlService.SendOpenCloseCmd(elevatorQueueItem.elevator_code, 4); //向电梯发送前门关门指令
|
||||
_ = await _db.Deleteable(elevatorQueueItem).ExecuteCommandAsync();
|
||||
@@ -347,7 +373,9 @@ namespace Tnb.WarehouseMgr
|
||||
{
|
||||
_ = InvokeGenPretaskExcute();
|
||||
}
|
||||
Logger.Information("--------------------------------------------------------");
|
||||
return await ToApiResult(HttpStatusCode.OK, "成功");
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user