using JSMachine.WMS.App.Dto;
using JSMachine.WMS.App.Dto.Enum;
using JSMachine.WMS.Business.RcsCallBack.IService.StrategyPattern;
using JSMachine.WMS.Domain.Entity;
using JSMachine.WMS.Infrastructure;
using JSMachine.WMS.Infrastructure.Helper;
using Microsoft.Extensions.DependencyInjection;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace JSMachine.WMS.Business.RcsCallBack.ServiceImpl.StrategyPatternImpl
{
///
/// 根据任务楼层、目标区域和提升机区域选择任务完成处理策略。
///
public class TaskCompletionStrategyFactory
{
///
/// 解析 AGV 任务完成后的后续处理策略。
///
/// 已完成的 AGV 任务。
/// 任务目标库位。
/// 匹配的策略实例;无法匹配时返回空值。
public ITaskCompletionStrategy GetStrategy(AGVTaskDto agvTask, StorageRackDto destWarehouse)
{
if (agvTask.Floor == FloorEnum.FirstFloor)
{
if (destWarehouse.Transport == TransportEnum.NormalArea)
return GlobalServericeProvidor.GetService();
else if (destWarehouse.ReservoirAreaId == 1091 || destWarehouse.ReservoirAreaId == 1092)
return GlobalServericeProvidor.GetService();
}
else if (
agvTask.Floor == FloorEnum.SecondFloor &&
(destWarehouse.Transport == TransportEnum.NormalArea || destWarehouse.Transport == TransportEnum.TransitArea))
{
return GlobalServericeProvidor.GetService();
}
return null;
}
}
}