dengjunjie
2 天以前 10c3dd5f5f3e5224029072074efc326dc38d9daf
´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/HKTaskMethods.cs
@@ -14,6 +14,7 @@
using WIDESEAWCS_DTO.AGV.HIKROBOT;
using System.Diagnostics.CodeAnalysis;
using System.Reflection.PortableExecutable;
using WIDESEAWCS_QuartzJob;
namespace WIDESEAWCS_TaskInfoService
{
@@ -33,6 +34,10 @@
            try
            {
                Dt_HKLocationInfo? hKLocationInfo = null;
                if (taskType==(int)TaskTypeEnum.STURR)
                {
                    var reslut=_stationInfo.Repository.QueryFirst(x=>x.StationCode==taskDTO.fromLocationCode) ?? throw new Exception($"未找到起点货位【{taskDTO.fromLocationCode}】");
                }
                #region ç‚¹åˆ°ç‚¹
                if (!string.IsNullOrEmpty(taskDTO.toLocationCode))
                {
@@ -43,6 +48,23 @@
                //获取货位信息
                else
                    hKLocationInfo = _hKLocationInfoService.GetFreeLocationInfo(taskDTO.toAreaCode) ?? throw new Exception($"未找到终点库区【{taskDTO.toAreaCode}】可用空货位!");
                if (taskType == (int)TaskTypeEnum.Q1TSJ4)
                {
                    var device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == "TSJ") as OtherDevice;
                    if (device.IsConnected)
                    {
                        var reslu = device.GetValue<HoistEnum, string>(HoistEnum.Emptycontainernumber);
                        var result = reslu?.TrimEnd('\0')?.Substring(2);
                        if (reslu == taskDTO.containerCode && result != null)
                        {
                            throw new Exception($"当前的料箱号为{reslu}与{taskDTO.containerCode}料箱号不匹配");
                        }
                    }
                    else
                    {
                        throw new Exception("提升机信息设备连接失败");
                    }
                }
                Dt_Task dt_Task = new Dt_Task()
                {
                    TaskNum = GetTaskNum(nameof(SequenceEnum.SeqTaskNum)),
@@ -108,10 +130,20 @@
            WebResponseContent content = new WebResponseContent();
            try
            {
                //4楼库内到提升机
                Dt_HKLocationInfo? hKLocationInfo = _hKLocationInfoService.Repository.QueryFirst(x => x.LocationCode == taskDTO.fromLocationCode) ?? throw new Exception($"未找到起点库位【{taskDTO.fromLocationCode}】!");
                if (hKLocationInfo.LocationStatus != LocationStatusEnum.InStock.ObjToInt()) throw new Exception($"起点库位【{taskDTO.fromLocationCode}】当前库位状态不可出库!");
                if (hKLocationInfo.PalletCode != taskDTO.containerCode) throw new Exception($"起点库位【{taskDTO.fromLocationCode}】绑定料箱号【{hKLocationInfo.PalletCode}】与任务料箱号【{taskDTO.containerCode}】不匹配!");
                Dt_Task dt_Task = new Dt_Task()
                //库内到现边的点到点任务,是否需要判断货位状态?
                if (taskType == (int)TaskTypeEnum.STU0003)
                {
                    var reslut = _stationInfo.Repository.QueryFirst(x => x.StationCode == taskDTO.toLocationCode) ?? throw new Exception($"未找到终点货位【{taskDTO.fromLocationCode}】");
                    if (reslut.StationStatus != (int)LocationStatusEnum.Free)
                    {
                        throw new Exception($"终点站台【{taskDTO.toLocationCode}】状态不为空闲!");
                    }
                }
                    Dt_Task dt_Task = new Dt_Task()
                {
                    TaskNum = GetTaskNum(nameof(SequenceEnum.SeqTaskNum)),
                    WMSTaskNum = taskDTO.taskCode,
@@ -226,21 +258,22 @@
                hIKROBOTTaskSubmit.initPriority = task.Grade;
                hIKROBOTTaskSubmit.robotTaskCode = task.WMSTaskNum;
                hIKROBOTTaskSubmit.taskType = tasktype.ToString(); ExtraDto extraDto = new ExtraDto();
                CarrierInfoDto carrierInfoDto = new CarrierInfoDto()
                if (task.TaskType != (int)TaskTypeEnum.MOVE && task.TaskType != (int)TaskTypeEnum.Q3RK && task.TaskType != (int)TaskTypeEnum.Q3CK && task.TaskType != (int)TaskTypeEnum.F01)
                {
                    carrierCode = task.PalletCode,
                    carrierType = task.PalletCode.Contains("LXM") ? "DX" : "SX"
                };
                extraDto.carrierInfo.Add(carrierInfoDto);
                hIKROBOTTaskSubmit.extra = extraDto;
                    CarrierInfoDto carrierInfoDto = new CarrierInfoDto()
                    {
                        carrierCode = task.PalletCode,
                        carrierType = task.PalletCode.Contains("LXM") ? "DX" : "SX"
                    };
                    extraDto.carrierInfo.Add(carrierInfoDto);
                    hIKROBOTTaskSubmit.extra = extraDto;
                }
                switch (tasktype)
                {
                    case TaskTypeEnum.CPInbound:
                    case TaskTypeEnum.CPOutbound:
                    case TaskTypeEnum.MLInbound:
                    case TaskTypeEnum.MLOutbound:
                        break;
                    case TaskTypeEnum.F01:
                        break;
                    case TaskTypeEnum.RK3F:
                    case TaskTypeEnum.CK3F:
@@ -266,6 +299,7 @@
                            hIKROBOTTaskSubmit.targetRoute.Add(targetRoute);
                        }
                        break;
                    case TaskTypeEnum.STURR:
                    case TaskTypeEnum.Q1TSJ4:
                        {
                            TargetRouteDto target = new TargetRouteDto()
@@ -309,7 +343,8 @@
                        break;
                    case TaskTypeEnum.Q3RK:
                    case TaskTypeEnum.Q3CK:
                    case TaskTypeEnum.Move:
                    case TaskTypeEnum.MOVE:
                    case TaskTypeEnum.F01:
                        {
                            TargetRouteDto target = new TargetRouteDto()
                            {
@@ -329,6 +364,26 @@
                            hIKROBOTTaskSubmit.targetRoute.Add(targetRoute);
                        }
                        break;
                    case TaskTypeEnum.STUPTBY:
                        {
                            TargetRouteDto target = new TargetRouteDto()
                            {
                                code = task.CurrentAddress,
                                operation = "DELIVERY",//取货
                                seq = 0,
                                type = "STORAGE",
                            };
                            TargetRouteDto targetRoute = new TargetRouteDto()
                            {
                                code = task.NextAddress,
                                operation = "DELIVERY",//送货
                                seq = 1,
                                type = "STORAGE",
                            };
                            hIKROBOTTaskSubmit.targetRoute.Add(target);
                            hIKROBOTTaskSubmit.targetRoute.Add(targetRoute);
                        }
                        break;
                    case TaskTypeEnum.CPMoveInventory:
                        break;
                    default: