dengjunjie
2026-03-10 2a73ec6d537d9b55f60fe0088678c99930eb84d8
优化成品库入库逻辑
已修改5个文件
62 ■■■■■ 文件已修改
代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_BasicInfoService/RGVLocationInfoService.cs 42 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/KLSTaskMethods.cs 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/RGVTaskMethods.cs 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskMethods.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/Task/KLSTaskExtend.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_BasicInfoService/RGVLocationInfoService.cs
@@ -20,10 +20,10 @@
        }
        private Dictionary<string, OrderByType> _emptyAssignOrderBy = new Dictionary<string, OrderByType>()
        {
            { nameof(Dt_RGVLocationInfo.Row), OrderByType.Asc },
            { nameof(Dt_RGVLocationInfo.Depth), OrderByType.Desc },
            { nameof(Dt_RGVLocationInfo.Layer), OrderByType.Asc },
            //{ nameof(Dt_RGVLocationInfo.Column), OrderByType.Asc },
            { nameof(Dt_RGVLocationInfo.Row), OrderByType.Asc },
        };
        private Dictionary<string, OrderByType> _DepthAscOrderBy = new Dictionary<string, OrderByType>()
        {
@@ -43,32 +43,36 @@
        public Dt_RGVLocationInfo? GetInFreeLocationInfo(string AreaCode)
        {
            Dt_RGVLocationInfo? rGVLocationInfo = null;
            List<Dt_RGVLocationInfo> rGVLocationInfos = BaseDal.QueryData(x => x.WarehouseId.ToString() == AreaCode && x.EnableStatus == EnableStatusEnum.Normal.ObjToInt() && x.LocationStatus == LocationStatusEnum.Free.ObjToInt(), _emptyAssignOrderBy);
            Dt_RGVLocationInfo? FreerGVLocationInfo = null;
            List<Dt_RGVLocationInfo> rGVLocationInfos = BaseDal.QueryData(x => x.WarehouseId.ToString() == AreaCode && x.EnableStatus == EnableStatusEnum.Normal.ObjToInt() && x.LocationStatus == LocationStatusEnum.Free.ObjToInt(), _emptyAssignOrderBy);//查找所有空货位
            if (rGVLocationInfos == null || rGVLocationInfos.Count < 1) return rGVLocationInfo;
            #region åˆ¤æ–­å··é“是否有货
            List<string> LocationCodes = new List<string>();
            foreach (var item in rGVLocationInfos)
            foreach (var items in rGVLocationInfos.GroupBy(x => x.RoadwayNo))//根据巷道号分组
            {
                Dt_RGVLocationInfo dt_RGVLocationInfo = BaseDal.QueryFirst(x => x.RoadwayNo == item.RoadwayNo && x.EnableStatus == EnableStatusEnum.Normal.ObjToInt() && x.Depth < item.Depth && x.LocationStatus == LocationStatusEnum.InStock.ObjToInt(), _emptyAssignOrderBy);
                if (dt_RGVLocationInfo == null) return dt_RGVLocationInfo;
                dt_RGVLocationInfo = BaseDal.QueryFirst(x => x.RoadwayNo == item.RoadwayNo && x.EnableStatus == EnableStatusEnum.Normal.ObjToInt() && x.Depth > item.Depth && x.LocationStatus == LocationStatusEnum.InStock.ObjToInt(), _DepthAscOrderBy);
                foreach (var item in items)
                {
                    List<Dt_RGVLocationInfo> dt_RGVLocationInfos = BaseDal.QueryData(x => x.RoadwayNo == items.Key);//查找当前巷道号货位
                    rGVLocationInfo = dt_RGVLocationInfos.Where(x => x.Depth < item.Depth && x.LocationStatus == LocationStatusEnum.InStock.ObjToInt()).FirstOrDefault();//判断浅深度货位是否有货
                    if (rGVLocationInfo != null)//浅深度货位有货,找深深度货位是否有货
                    {
                        if (item.LocationType == 1) break;//巷道类型为单向,直接跳过
                        foreach (var locationInfo in rGVLocationInfos.Where(x => x.RoadwayNo == items.Key).OrderBy(x => x.Depth))
                        {
                            if (!dt_RGVLocationInfos.Where(x => x.LocationStatus == LocationStatusEnum.InStock.ObjToInt() && x.Depth > locationInfo.Depth).Any()) return locationInfo;
            }
            if (rGVLocationInfo != null)
            {
                List<string> NoRoadwayNos = new List<string>();
                while (true)
                {
                    Dt_RGVLocationInfo dt_RGVLocationInfo = BaseDal.QueryFirst(x => x.RoadwayNo == rGVLocationInfo.RoadwayNo && x.Depth < rGVLocationInfo.Depth && x.LocationStatus == LocationStatusEnum.InStock.ObjToInt(), _emptyAssignOrderBy);
                    if (dt_RGVLocationInfo == null) return rGVLocationInfo;
                    rGVLocationInfo = BaseDal.QueryFirst(x => x.RoadwayNo == dt_RGVLocationInfo.RoadwayNo && x.EnableStatus == EnableStatusEnum.Normal.ObjToInt() && x.Depth > dt_RGVLocationInfo.Depth && x.LocationStatus == LocationStatusEnum.Free.ObjToInt(), _DepthAscOrderBy);
                    dt_RGVLocationInfo = BaseDal.QueryFirst(x => x.RoadwayNo == rGVLocationInfo.RoadwayNo && x.Depth > rGVLocationInfo.Depth && x.LocationStatus == LocationStatusEnum.InStock.ObjToInt(), _emptyAssignOrderBy);
                    if (dt_RGVLocationInfo == null) return rGVLocationInfo;
                        //rGVLocationInfo = dt_RGVLocationInfos.Where(x => x.LocationStatus == LocationStatusEnum.Free.ObjToInt()).OrderBy(x => x.Depth).FirstOrDefault();//找浅深度空货位
                        //if (rGVLocationInfo != null)
                        //{
                        //    if (dt_RGVLocationInfos.Where(x => x.Depth > rGVLocationInfo.Depth && x.LocationStatus == LocationStatusEnum.InStock.ObjToInt()).FirstOrDefault() == null)//判断深深度货位是否有货
                        //        return rGVLocationInfo;
                        //}
                    }
                    else return item;
                }
            }
            #endregion
            return rGVLocationInfo;
            return FreerGVLocationInfo;
        }
    }
}
´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/KLSTaskMethods.cs
@@ -27,6 +27,13 @@
            try
            {
                int containerType = taskDTO.containerCode.Contains("LLM") ? LocationTypeEnum.LargePallet.ObjToInt() : LocationTypeEnum.SmallPallet.ObjToInt();
                #region ç‚¹åˆ°ç‚¹
                if (!string.IsNullOrEmpty(taskDTO.toLocationCode))
                {
                    var LocationInfo = _kLSLocationInfoService.Repository.QueryFirst(x => x.LocationCode == taskDTO.toLocationCode) ?? throw new Exception($"未找到终点货位【{taskDTO.toLocationCode}】");
                    if (LocationInfo.LocationStatus != LocationStatusEnum.Free.ObjToInt()) throw new Exception($"终点货位【{taskDTO.toLocationCode}】货位状态不为空货位");
                }
                #endregion
                //获取货位信息
                Dt_KLSLocationInfo? kLSLocationInfo = _kLSLocationInfoService.GetFreeLocationInfo(taskDTO.toAreaCode, containerType) ?? throw new Exception($"未找到终点库区【{taskDTO.toAreaCode}】可用空货位!");
                Dt_Task dt_Task = new()
´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/RGVTaskMethods.cs
@@ -31,6 +31,13 @@
            WebResponseContent content = new WebResponseContent();
            try
            {
                #region ç‚¹åˆ°ç‚¹
                //if (!string.IsNullOrEmpty(taskDTO.toLocationCode))
                //{
                //    var LocationInfo = _rGVLocationInfoService.Repository.QueryFirst(x => x.LocationCode == taskDTO.toLocationCode) ?? throw new Exception($"未找到终点货位【{taskDTO.toLocationCode}】");
                //    if (LocationInfo.LocationStatus != LocationStatusEnum.Free.ObjToInt()) throw new Exception($"终点货位【{taskDTO.toLocationCode}】货位状态不为空货位");
                //}
                #endregion
                Dt_StationManger stationManger = _stationMangerService.GetInStationInfo(taskDTO.fromLocationCode) ?? throw new Exception($"未找到起点位置【{taskDTO.fromLocationCode}】站台信息!");
                Dt_Task dt_Task = new()
                {
´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskMethods.cs
@@ -71,10 +71,10 @@
                    if (task == null) throw new Exception($"未找到任务,任务编号【{hIKROBOT.robotTaskCode}】");
                    switch (hIKROBOT.extra.values.method)
                    {
                        case "start":
                        case "end":
                            TaskCompleted(task, deviceTypeEnum);
                            break;
                        case "end":
                        case "outbin":
                            TaskFromCompleted(task, deviceTypeEnum);
                            break;
                        default:
´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/Task/KLSTaskExtend.cs
@@ -30,7 +30,7 @@
                    GALAXISTask gALAXISTask = new GALAXISTask()
                    {
                        taskId = task.WMSTaskNum,
                        taskType = task.TaskType == (int)TaskTypeEnum.MLInbound ? 2 : 1,
                        taskType = task.TaskType == (int)TaskTypeEnum.MLInbound ? 0 : 1,
                        barCode = task.PalletCode,
                        endNode = task.TargetAddress,
                        startNode = task.SourceAddress,