yanjinhui
2026-03-12 7f8c10c679b319543bc21a3e4f49534475499ce4
优化
已修改3个文件
70 ■■■■■ 文件已修改
代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs 28 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/Task/KLSTaskExtend.cs 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/Task/RGVTaskExtend.cs 39 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs
@@ -18,6 +18,7 @@
using AutoMapper;
using SixLabors.ImageSharp.ColorSpaces;
using SqlSugar;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using WIDESEAWCS_BasicInfoService;
using WIDESEAWCS_Common;
@@ -106,7 +107,7 @@
                            continue;
                            //throw new Exception(content.Message);
                        }
                        if (BaseDal.QueryFirst(x => x.WMSTaskNum == task.taskCode) != null)
                        if (BaseDal.QueryFirst(x => x.WMSTaskNum == task.taskCode && x.TaskType == item.taskType) != null)
                        {
                            objects.Add(new
                            {
@@ -116,7 +117,7 @@
                            continue;
                            //throw new Exception($"任务号【{task.taskCode}】已存在任务");
                        }
                        if (BaseDal.QueryFirst(x => x.PalletCode == task.containerCode) != null)
                        if (BaseDal.QueryFirst(x => x.PalletCode == task.containerCode && x.TaskType == item.taskType) != null)
                        {
                            objects.Add(new
                            {
@@ -126,7 +127,7 @@
                            continue;
                            //throw new Exception($"托盘号【{task.containerCode}】已存在任务");
                        }
                        if (BaseDal.QueryFirst(x => x.SourceAddress == task.fromLocationCode) != null)
                        if (BaseDal.QueryFirst(x => x.SourceAddress == task.fromLocationCode && x.TaskType == item.taskType) != null)
                        {
                            objects.Add(new
                            {
@@ -232,6 +233,7 @@
                    if (apiInfo == null) throw new Exception("未找到凯乐士AGV任务下发接口配置信息!请检查接口配置");
                    string response = HttpHelper.Post(apiInfo.ApiAddress, KLS.Serialize());
                    GALAXISReturn agvContent = response.DeserializeObject<GALAXISReturn>();
                    content.OK(data: agvContent);
                    if (agvContent.success == true && agvContent.code == 0)
                    {
                        //直接移入历史
@@ -258,6 +260,7 @@
                    if (apiInfo == null) throw new Exception("未找到四向车AGV任务下发接口配置信息!请检查接口配置");
                    string response = HttpHelper.Post(apiInfo.ApiAddress, cancelSXCTake.Serialize());
                    FOURBOTReturn fOURBOTReturn = response.DeserializeObject<FOURBOTReturn>();
                    content.OK(data: fOURBOTReturn);
                    if (fOURBOTReturn.returnCode == 0 && fOURBOTReturn.returnUserMsg == "成功")
                    {
                        //直接移入历史
@@ -282,6 +285,7 @@
                    if (apiInfo == null) throw new Exception("未找到四向车AGV任务下发接口配置信息!请检查接口配置");
                    string response = HttpHelper.Post(apiInfo.ApiAddress, cancelHIKROBOTTask.Serialize());
                    HIKROBOTReturn hIKROBOTReturn = response.DeserializeObject<HIKROBOTReturn>();
                    content.OK(data: hIKROBOTReturn);
                    if (hIKROBOTReturn.code == "SUCCESS" && hIKROBOTReturn.message == "成功")
                    {
                        //直接移入历史
@@ -372,6 +376,7 @@
                    if (apiInfo == null) throw new Exception("未找到凯乐士AGV任务下发接口配置信息!请检查接口配置");
                    string response = HttpHelper.Post(apiInfo.ApiAddress, updateGALAXISTaskGrade.Serialize());
                    GALAXISReturn agvContent = response.DeserializeObject<GALAXISReturn>();
                    content.OK(data: agvContent);
                    if (agvContent.success == true && agvContent.code == 0)
                    {
@@ -397,6 +402,7 @@
                    if (apiInfo == null) throw new Exception("未找到更新四向车任务优先级接口配置信息!请检查接口配置");
                    string response = HttpHelper.Post(apiInfo.ApiAddress, request.Serialize());
                    FOURBOTReturn fOURBOTReturn = response.DeserializeObject<FOURBOTReturn>();
                    content.OK(data: fOURBOTReturn);
                    if (fOURBOTReturn.returnCode == 0 && fOURBOTReturn.returnUserMsg == "成功")
                    {
                        BaseDal.UpdateData(dt_Task);
@@ -421,6 +427,7 @@
                    if (apiInfo == null) throw new Exception("未找到四向车AGV任务下发接口配置信息!请检查接口配置");
                    string response = HttpHelper.Post(apiInfo.ApiAddress, Hkrequest.Serialize());
                    HIKROBOTReturn hIKROBOTReturn = response.DeserializeObject<HIKROBOTReturn>();
                    content.OK(data: hIKROBOTReturn);
                    if (hIKROBOTReturn.code == "SUCCESS0" && hIKROBOTReturn.message == "成功")
                    {
                        BaseDal.UpdateData(dt_Task);
@@ -1078,11 +1085,15 @@
            try
            {
                if (getLocationInfo == null) throw new Exception("请求参数不能为空!");
                if (getLocationInfo.AreaCode == null) throw new Exception("库区编号不能为空!");
                //if (getLocationInfo.AreaCode == null) throw new Exception("库区编号不能为空!");
                if (getLocationInfo.WarehouseId == 0) throw new Exception("仓库ID不能为空!");
                if (getLocationInfo.WarehouseId == 1)
                {
                    List<Dt_RGVLocationInfo> rGVLocationInfos = _rGVLocationInfoService.Repository.QueryData(x => x.WarehouseId == getLocationInfo.AreaCode.ObjToInt());
                    List<Dt_RGVLocationInfo> rGVLocationInfos = new List<Dt_RGVLocationInfo>();
                    if (!string.IsNullOrEmpty(getLocationInfo.AreaCode))
                        rGVLocationInfos = _rGVLocationInfoService.Repository.QueryData(x => x.WarehouseId == getLocationInfo.AreaCode.ObjToInt());
                    else
                        rGVLocationInfos = _rGVLocationInfoService.Repository.QueryData();
                    foreach (var item in rGVLocationInfos)
                    {
                        list.Add(new
@@ -1096,7 +1107,11 @@
                }
                else if (getLocationInfo.WarehouseId == 2)
                {
                    List<Dt_KLSLocationInfo> rGVLocationInfos = _kLSLocationInfoService.Repository.QueryData(x => x.WarehouseId == getLocationInfo.AreaCode.ObjToInt());
                    List<Dt_KLSLocationInfo> rGVLocationInfos = new List<Dt_KLSLocationInfo>();
                    if (!string.IsNullOrEmpty(getLocationInfo.AreaCode))
                        rGVLocationInfos = _kLSLocationInfoService.Repository.QueryData(x => x.WarehouseId == getLocationInfo.AreaCode.ObjToInt());
                    else
                        rGVLocationInfos = _kLSLocationInfoService.Repository.QueryData();
                    foreach (var item in rGVLocationInfos)
                    {
                        list.Add(new
@@ -1221,6 +1236,7 @@
                };
                string response = HttpHelper.Post(apiInfo.ApiAddress, fOURBOToccupyStation.Serialize());
                FOURBOTReturn fOURBOTReturn = response.DeserializeObject<FOURBOTReturn>();
                content.OK(data: fOURBOTReturn);
                if (fOURBOTReturn.returnCode != 0 /*&& fOURBOTReturn.returnUserMsg != $"站点已被占用,(podID={iQC.ContainerCode})"*/)
                    throw new Exception(fOURBOTReturn.returnUserMsg);
                #endregion
´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/Task/KLSTaskExtend.cs
@@ -8,6 +8,7 @@
using WIDESEAWCS_Core;
using WIDESEAWCS_Core.Helper;
using WIDESEAWCS_DTO;
using WIDESEAWCS_DTO.RGV.FOURBOT;
using WIDESEAWCS_Model.Models;
namespace WIDESEAWCS_Tasks
@@ -41,7 +42,7 @@
                Dt_ApiInfo? apiInfo = _apiInfoService.Repository.QueryFirst(x => x.ApiCode == nameof(GALAXISTaskInfo)) ?? throw new Exception("未找到凯乐士AGV任务下发接口配置信息!请检查接口配置");
                string response = HttpHelper.Post(apiInfo.ApiAddress, gALAXISTaskInfo.Serialize());
                GALAXISReturn agvContent = response.DeserializeObject<GALAXISReturn>();
                content.Data = agvContent;
                content.OK(data: agvContent);
                if (agvContent.success)
                {
                    if (agvContent.data.returnStatus != 0) throw new Exception(agvContent.data.returnInfo);
´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/Task/RGVTaskExtend.cs
@@ -51,7 +51,7 @@
                    {
                        string response = HttpHelper.Post(apiInfo.ApiAddress, fOURBOTnewMovePodTask.Serialize());
                        FOURBOTReturn fOURBOTReturn = response.DeserializeObject<FOURBOTReturn>();
                        content.Data = fOURBOTReturn;
                        content.OK(data: fOURBOTReturn);
                        if (fOURBOTReturn.returnCode != 0) throw new Exception(fOURBOTReturn.returnUserMsg);
                        string dataJson = fOURBOTReturn.data.ToString();
@@ -113,7 +113,7 @@
                    fOURBOTnewMovePodTask.desNodeID = item.NextAddress;
                    string response = HttpHelper.Post(apiInfo.ApiAddress, fOURBOTnewMovePodTask.Serialize());
                    FOURBOTReturn fOURBOTReturn = response.DeserializeObject<FOURBOTReturn>();
                    content.Data = fOURBOTReturn;
                    content.OK(data: fOURBOTReturn);
                    if (fOURBOTReturn.returnCode == 0)
                    {
                        string dataJson = fOURBOTReturn.data.ToString();
@@ -172,7 +172,7 @@
                //content.candidatePodIDs = tasks.Select(x => x.PalletCode).ToList();
                string response = HttpHelper.Post(apiInfo.ApiAddress, request.Serialize());
                FOURBOTReturn fOURBOTReturn = response.DeserializeObject<FOURBOTReturn>();
                content.Data = fOURBOTReturn;
                content.OK(data: fOURBOTReturn);
                if (fOURBOTReturn.returnCode == 0)
                {
                    //ReturnBlockPodResultDto getBlockPod = fOURBOTReturn.data as ReturnBlockPodResultDto ?? throw new Exception("未获取到阻碍托盘关系数据");
@@ -266,7 +266,7 @@
                            string response = HttpHelper.Post(apiInfo.ApiAddress, fOURBOTnewMovePodTask.Serialize());
                            var fOURBOTReturn = response.DeserializeObject<FOURBOTReturn>();
                            content.Data = fOURBOTReturn;
                            content.OK(data: fOURBOTReturn);
                            if (fOURBOTReturn.returnCode == 0)
                            {
                                var data = fOURBOTReturn.data.ToString();
@@ -278,12 +278,12 @@
                                locationsToUpdate.Add(rGVLocationInfo);
                                #region é‡Šæ”¾å…¥åº“站台
                                var stationManger = _stationMangerService.GetInStationInfo(item.SourceAddress);
                                if (stationManger != null)
                                {
                                    stationManger.IsOccupied = LocationStatusEnum.Free.ObjToInt();
                                    stationsToUpdate.Add(stationManger);
                                }
                                //var stationManger = _stationMangerService.GetInStationInfo(item.SourceAddress);
                                //if (stationManger != null)
                                //{
                                //    stationManger.IsOccupied = LocationStatusEnum.Free.ObjToInt();
                                //    stationsToUpdate.Add(stationManger);
                                //}
                                content.OK();
                                #endregion
                            }
@@ -386,8 +386,8 @@
                            _taskService.UpdateData(tasksToUpdate);
                        if (locationsToUpdate.Any())
                            _rGVLocationInfoService.UpdateData(locationsToUpdate);
                        if (stationsToUpdate.Any())
                            _stationMangerService.UpdateData(stationsToUpdate);
                        //if (stationsToUpdate.Any())
                        //    _stationMangerService.UpdateData(stationsToUpdate);
                        _unitOfWorkManage.CommitTran();
                    }
@@ -445,6 +445,7 @@
                        //FOURBOTnewMovePodTaskResponseData fOURBO = fOURBOTReturn.data as FOURBOTnewMovePodTaskResponseData ?? throw new Exception("未获取到四向车返回的任务ID");
                        string dataJson = fOURBOTReturn.data.ToString();
                        FOURBOTnewMovePodTaskResponseData? fOURBO = JsonConvert.DeserializeObject<FOURBOTnewMovePodTaskResponseData>(dataJson);
                        content.OK(data: fOURBO);
                        if (fOURBO == null || fOURBO.taskID == 0)
                        {
                            throw new Exception($"未获取到四向车返回的任务ID,返回数据:{response}");
@@ -537,7 +538,7 @@
                }
                string response = HttpHelper.Post(apiInfo.ApiAddress, moveBlock.Serialize());
                FOURBOTReturn fOURBOTReturn = response.DeserializeObject<FOURBOTReturn>();
                content.Data = fOURBOTReturn;
                content.OK(data: fOURBOTReturn);
                if (fOURBOTReturn.returnCode == 0)
                {
                    string dataJson = fOURBOTReturn.data.ToString();
@@ -607,8 +608,12 @@
                {
                    i++;
                    var stationManger = _stationMangerService.GetOutStationInfo(item.TargetAddress);
                    //if (stationManger.IsOccupied != LocationStatusEnum.Free.ObjToInt())
                    //{
                    //    item.ExceptionMessage = $"出库站台【{stationManger.StationCode}】被占用";
                    //    continue;
                    //}
                    item.NextAddress = stationManger.StationCode;
                    if (stationManger.IsOccupied != LocationStatusEnum.Free.ObjToInt()) continue;
                    #region ä¸‹å‘出库任务
                    fOURBOTnewMovePodTask.priority = item.Grade;
                    fOURBOTnewMovePodTask.podID = item.PalletCode;
@@ -626,7 +631,7 @@
                    fOURBOTnewMovePodTask.requestID = DateTime.Now.ToString("yyyyMMddHHmmss") + i;
                    string response = HttpHelper.Post(apiInfo.ApiAddress, fOURBOTnewMovePodTask.Serialize());
                    FOURBOTReturn fOURBOTReturn = response.DeserializeObject<FOURBOTReturn>();
                    content.Data = fOURBOTReturn;
                    content.OK(data: fOURBOTReturn);
                    if (fOURBOTReturn.returnCode == 0)
                    {
                        string dataJson = fOURBOTReturn.data.ToString();
@@ -637,8 +642,8 @@
                        }
                        item.RGVTaskId = fOURBO.taskID;
                        item.TaskState = (int)TaskStatusEnum.Execut;
                        stationManger.IsOccupied = LocationStatusEnum.Lock.ObjToInt();
                        _stationMangerService.UpdateData(stationManger);
                        //stationManger.IsOccupied = LocationStatusEnum.Lock.ObjToInt();
                        //_stationMangerService.UpdateData(stationManger);
                    }
                    #endregion
                }