wangxinhui
17 小时以前 ffb5bb3a68ae74ed3a1765baf946336cead3bb0d
货位同侧移库,干膜货位大小托分配优化,WCS任务接收优化等
已修改9个文件
123 ■■■■ 文件已修改
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Service/AssignLocation/LocationInfoService_CSJ.cs 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Service/AssignLocation/LocationInfoService_GM.cs 28 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Service/AssignLocation/LocationInfoService_ZH.cs 34 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Service/LocationInfoService_Common.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_Common/LocationEnum/LocationStatusEnum.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/MesOutboundOrderService.cs 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockInfoService.cs 31 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/MesTaskService.cs 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Outbound.cs 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Service/AssignLocation/LocationInfoService_CSJ.cs
@@ -72,14 +72,13 @@
                        throw new Exception($"未找到货位信息");
                    }
                    int maxDepth = locationInfos.Max(x => x.Depth);
                    int mathCurrentRow = beRelocation.Row - Convert.ToInt32(Math.Ceiling(beRelocation.Row / maxDepth / 2.0)) * maxDepth * 2;
                    if (mathCurrentRow <= maxDepth)
                    if (beRelocation.Row <= maxDepth)
                    {
                        locationInfos = locationInfos.Where(x => x.Row - Convert.ToInt32(Math.Ceiling(x.Row / maxDepth / 2.0)) * maxDepth * 2 <= maxDepth).ToList();
                        locationInfos = locationInfos.Where(x => x.Row <= maxDepth).ToList();
                    }
                    else
                    else if (beRelocation.Row > maxDepth)
                    {
                        locationInfos = locationInfos.Where(x => x.Row - Convert.ToInt32(Math.Ceiling(x.Row / maxDepth / 2.0)) * maxDepth * 2 > maxDepth).ToList();
                        locationInfos = locationInfos.Where(x => x.Row > maxDepth).ToList();
                    }
                }
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Service/AssignLocation/LocationInfoService_GM.cs
@@ -58,22 +58,24 @@
                        throw new Exception($"未找到货位信息");
                    }
                    int maxDepth = locationInfos.Max(x => x.Depth);
                    int mathCurrentRow = beRelocation.Row - Convert.ToInt32(Math.Ceiling(beRelocation.Row / maxDepth / 2.0)) * maxDepth * 2;
                    if (mathCurrentRow <= maxDepth)
                    //int mathCurrentRow = beRelocation.Row - Convert.ToInt32(Math.Ceiling(beRelocation.Row / maxDepth / 2.0)) * maxDepth * 2;
                    //if (mathCurrentRow <= maxDepth)
                    //{
                    //    locationInfos = locationInfos.Where(x => x.Row - Convert.ToInt32(Math.Ceiling(x.Row / maxDepth / 2.0)) * maxDepth * 2 <= maxDepth).ToList();
                    //}
                    //else
                    //{
                    //    locationInfos = locationInfos.Where(x => x.Row - Convert.ToInt32(Math.Ceiling(x.Row / maxDepth / 2.0)) * maxDepth * 2 > maxDepth).ToList();
                    //}
                    if (beRelocation.Row <= maxDepth)
                    {
                        locationInfos = locationInfos.Where(x => x.Row - Convert.ToInt32(Math.Ceiling(x.Row / maxDepth / 2.0)) * maxDepth * 2 <= maxDepth).ToList();
                        if (beRelocation.Row <= maxDepth)
                        {
                            locationInfos = locationInfos.Where(x=>x.Row <= maxDepth).ToList();
                        }
                        locationInfos = locationInfos.Where(x => x.Row <= maxDepth).ToList();
                    }
                    else
                    else if (beRelocation.Row > maxDepth)
                    {
                        locationInfos = locationInfos.Where(x => x.Row - Convert.ToInt32(Math.Ceiling(x.Row / maxDepth / 2.0)) * maxDepth * 2 > maxDepth).ToList();
                        if (beRelocation.Row > maxDepth)
                        {
                            locationInfos = locationInfos.Where(x => x.Row > maxDepth).ToList();
                        }
                        locationInfos = locationInfos.Where(x => x.Row > maxDepth).ToList();
                    }
                }
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Service/AssignLocation/LocationInfoService_ZH.cs
@@ -58,14 +58,22 @@
                        throw new Exception($"未找到货位信息");
                    }
                    int maxDepth = locationInfos.Max(x => x.Depth);
                    int mathCurrentRow = beRelocation.Row - Convert.ToInt32(Math.Ceiling(beRelocation.Row / maxDepth / 2.0)) * maxDepth * 2;
                    if (mathCurrentRow <= maxDepth)
                    //int mathCurrentRow = beRelocation.Row - Convert.ToInt32(Math.Ceiling(beRelocation.Row / maxDepth / 2.0)) * maxDepth * 2;
                    //if (mathCurrentRow <= maxDepth)
                    //{
                    //    locationInfos = locationInfos.Where(x => x.Row - Convert.ToInt32(Math.Ceiling(x.Row / maxDepth / 2.0)) * maxDepth * 2 <= maxDepth).ToList();
                    //}
                    //else
                    //{
                    //    locationInfos = locationInfos.Where(x => x.Row - Convert.ToInt32(Math.Ceiling(x.Row / maxDepth / 2.0)) * maxDepth * 2 > maxDepth).ToList();
                    //}
                    if (beRelocation.Row <= maxDepth)
                    {
                        locationInfos = locationInfos.Where(x => x.Row - Convert.ToInt32(Math.Ceiling(x.Row / maxDepth / 2.0)) * maxDepth * 2 <= maxDepth).ToList();
                        locationInfos = locationInfos.Where(x => x.Row <= maxDepth).ToList();
                    }
                    else
                    else if (beRelocation.Row > maxDepth)
                    {
                        locationInfos = locationInfos.Where(x => x.Row - Convert.ToInt32(Math.Ceiling(x.Row / maxDepth / 2.0)) * maxDepth * 2 > maxDepth).ToList();
                        locationInfos = locationInfos.Where(x => x.Row > maxDepth).ToList();
                    }
                }
@@ -139,6 +147,14 @@
                                    continue;
                                }
                            }
                            if (palletTypeInfo.IsOdd)
                            {
                                Dt_LocationInfo? locationInfoExist = locationInfoDepth.FirstOrDefault(x => x.Row == locationInfo.Row  && x.Column == (locationInfo.Column-1) && x.Layer == locationInfo.Layer);
                                if (locationInfoExist!=null && locationInfoExist.LocationStatus!= LocationStatusEnum.Free.ObjToInt() && locationInfoExist.LocationStatus != LocationStatusEnum.FreeLock.ObjToInt())
                                {
                                    continue;
                                }
                            }
                            locationCaches_ZH.Add(new LocationCache { LocationCode = locationInfo.LocationCode, DateTime = DateTime.Now });
                            return locationInfo;
                        }
@@ -203,6 +219,14 @@
                                    continue;
                                }
                            }
                            if (palletTypeInfo.IsOdd)
                            {
                                Dt_LocationInfo? locationInfoExist = locationInfoDepth.FirstOrDefault(x => x.Row == locationInfo.Row && x.Column == (locationInfo.Column - 1) && x.Layer == locationInfo.Layer);
                                if (locationInfoExist != null && locationInfoExist.LocationStatus != LocationStatusEnum.Free.ObjToInt() && locationInfoExist.LocationStatus != LocationStatusEnum.FreeLock.ObjToInt())
                                {
                                    continue;
                                }
                            }
                            locationCaches_ZH.Add(new LocationCache { LocationCode = locationInfo.LocationCode, DateTime = DateTime.Now });
                            return locationInfo;
                        }
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Service/LocationInfoService_Common.cs
@@ -508,6 +508,10 @@
            for (int j = location.Depth - 1; j >= 1; j--)
            {
                Dt_LocationInfo? locationInfo = locationInfos.FirstOrDefault(x => x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && (x.Row == row + 1 || x.Row == row - 1));
                if (j == 1 && location.RoadwayNo.Contains("CSJ") && (row==1 || row==6))
                {
                    locationInfo = locationInfos.FirstOrDefault(x => x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && (x.Row == row + 2 || x.Row == row - 2));
                }
                if (locationInfo != null)
                {
                    groupLocations.Add(locationInfo);
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_Common/LocationEnum/LocationStatusEnum.cs
@@ -30,7 +30,7 @@
        InStockLock = 10,
        /// <summary>
        /// æœ‰è´§é”å®š
        /// ç©ºé—²é”å®š
        /// </summary>
        [Description("空闲锁定")]
        FreeLock = 20,
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/MesOutboundOrderService.cs
@@ -60,19 +60,19 @@
            float originalNeedQuantity = mesOutboundOrder.OrderQuantity;
            float needQuantity = originalNeedQuantity;
            //获取库存
            List<Dt_StockInfo> stockInfos = _stockService.StockInfoService.GetUseableStocks(mesOutboundOrder.MaterialCode, "", mesOutboundOrder.WarehouseId);
            if (!stockInfos.Any())
            {
                throw new Exception($"未找到可分配库存");
            }
            List<Dt_StockInfo> autoAssignStocks = _stockService.StockInfoService.GetOutboundStocks(stockInfos, mesOutboundOrder.MaterialCode, needQuantity, out float residueQuantity);
            mesOutboundOrder.LockQuantity += needQuantity - residueQuantity;
            if (residueQuantity>0)
            {
                throw new Exception($"库存不足");
            }
            autoAssignStocks.OrderBy(x => x.Details.FirstOrDefault()?.StockQuantity).ToList();
            outStocks.AddRange(autoAssignStocks);
            float assignQuantity = needQuantity - residueQuantity;
            float orderQuantity = mesOutboundOrder.OrderQuantity;
            for (int j = 0; j < autoAssignStocks.Count; j++)
            {
                float detailAssignQuantity = outStockLockInfos.Where(x => x.MaterielCode == mesOutboundOrder.MaterialCode).Sum(x => x.AssignQuantity);//出库订单明细已分配数量
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockInfoService.cs
@@ -267,36 +267,7 @@
            }
            else
            {
                for (int i = 0; i < stockInfos.Count; i++)
                {
                    Dt_StockInfo stockInfo = stockInfos[i];
                    float useableStockQuantity = stockInfo.Details.Where(x => x.MaterielCode == materielCode).Sum(x => x.StockQuantity - x.OutboundQuantity);
                    if (useableStockQuantity < needQuantity)
                    {
                        stockInfo.Details.ForEach(x => x.OutboundQuantity = x.StockQuantity);
                        needQuantity -= useableStockQuantity;
                    }
                    else
                    {
                        stockInfo.Details.ForEach(x =>
                        {
                            if (x.StockQuantity > x.OutboundQuantity && x.MaterielCode == materielCode)
                            {
                                if (x.StockQuantity - x.OutboundQuantity >= needQuantity)
                                {
                                    x.OutboundQuantity += needQuantity;
                                    needQuantity = 0;
                                }
                                else
                                {
                                    needQuantity -= (x.StockQuantity - x.OutboundQuantity);
                                    x.OutboundQuantity = x.StockQuantity;
                                }
                            }
                        });
                    }
                    outStocks.Add(stockInfo);
                }
                throw new Exception("库存不足");
            }
            residueQuantity = needQuantity;
            return outStocks;
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/MesTaskService.cs
@@ -531,9 +531,11 @@
                List<Dt_OutStockLockInfo>? outStockLockInfos = null;
                List<Dt_LocationInfo>? locationInfos = null;
                {
                    //分配库存
                    (List<Dt_StockInfo>, Dt_MesOutboundOrder, List<Dt_OutStockLockInfo>, List<Dt_LocationInfo>) result = _outboundService.MesOutboundOrderService.AssignStockOutbound(mesOutboundOrder);
                    if (result.Item1 != null && result.Item1.Count > 0)
                    {
                        //创建任务
                        tasks = GetTasks(result.Item1, TaskTypeEnum.MesOutbound);
                        result.Item2.OrderStatus = OrderDetailStatusEnum.Outbound.ObjToInt();
                        result.Item3.ForEach(x =>
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Outbound.cs
@@ -601,13 +601,14 @@
        public List<Dt_Task> GetTasks(List<Dt_StockInfo> stockInfos, TaskTypeEnum taskType)
        {
            List<Dt_Task> tasks = new List<Dt_Task>();
            List<Dt_LocationInfo> locationInfos = _basicService.LocationInfoService.Repository.QueryData(x => stockInfos.Select(x=>x.LocationCode).Contains(x.LocationCode));
            for (int i = 0; i < stockInfos.Count; i++)
            {
                Dt_StockInfo stockInfo = stockInfos[i];
                if (stockInfo != null)
                {
                    Dt_LocationInfo locationInfo = _basicService.LocationInfoService.Repository.QueryFirst(x => x.LocationCode == stockInfo.LocationCode);
                    Dt_LocationInfo? locationInfo = locationInfos.FirstOrDefault(x => x.LocationCode == stockInfo.LocationCode);
                    if (!tasks.Exists(x => x.PalletCode == stockInfo.PalletCode))
                    {
                        Dt_Task task = new()