wangxinhui
4 天以前 9ec715d2deb18a269dd49c48da91a36632d08c81
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Service/AssignLocation/LocationInfoService_ZH.cs
@@ -43,6 +43,8 @@
                List<string> lockLocationCodes = locationCaches_ZH.Select(x => x.LocationCode).ToList();
                List<Dt_LocationInfo> locationInfos = Repository.QueryData(x => x.RoadwayNo == roadwayNo);
                //获取所有货位数据
                List<Dt_LocationInfo> locationInfoDepth = Repository.QueryData(x => x.RoadwayNo == roadwayNo);
                if (locationInfos == null || locationInfos.Count == 0)
                {
                    throw new Exception($"未找到该巷道的货位信息,巷道号:{roadwayNo}");
@@ -87,6 +89,56 @@
                        Dt_LocationInfo? locationInfo = GetUsableLocation_ZH(locationInfos, undefinedTypeEmptyLocation, palletType);
                        if (locationInfo != null)
                        {
                            if (locationInfo.Depth < locationInfoDepth.Max(x => x.Depth))
                            {
                                Dt_LocationInfo? locationInfoExist = null;
                                int Column = locationInfo.Column;
                                if (locationInfo.Row - locationInfo.Depth == locationInfo.Depth)
                                {
                                    locationInfoExist = locationInfoDepth.FirstOrDefault(x => x.Row == (locationInfo.Row - 1) && x.Column == Column && x.Layer == locationInfo.Layer);
                                }
                                else
                                {
                                    locationInfoExist = locationInfoDepth.FirstOrDefault(x => x.Row == (locationInfo.Row + 1) && x.Column == Column && x.Layer == locationInfo.Layer);
                                }
                                //获取深位货位类型
                                if (locationInfoExist == null)
                                {
                                    continue;
                                }
                                Dt_PalletTypeInfo palletTypeInfoDepth = _basicRepository.PalletTypeInfoRepository.QueryFirst(x => x.WarehouseId == locationInfoExist.WarehouseId && x.PalletType == locationInfoExist.LocationType);
                                if (palletTypeInfoDepth != null && palletTypeInfoDepth.LocaitonCount != palletTypeInfo.LocaitonCount)
                                {
                                    continue;
                                }
                            }
                            else
                            {
                                Dt_LocationInfo? locationInfoExist = null;
                                int Column = locationInfo.Column;
                                if (locationInfo.Row % 2 == 0)
                                {
                                    locationInfoExist = locationInfoDepth.FirstOrDefault(x => x.Row == (locationInfo.Row - 1) && x.Column == Column && x.Layer == locationInfo.Layer);
                                }
                                else
                                {
                                    locationInfoExist = locationInfoDepth.FirstOrDefault(x => x.Row == (locationInfo.Row + 1) && x.Column == Column && x.Layer == locationInfo.Layer);
                                }
                                //获取深位货位类型
                                if (locationInfoExist == null)
                                {
                                    continue;
                                }
                                Dt_PalletTypeInfo palletTypeInfoDepth = _basicRepository.PalletTypeInfoRepository.QueryFirst(x => x.WarehouseId == locationInfoExist.WarehouseId && x.PalletType == locationInfoExist.LocationType);
                                if (palletTypeInfoDepth != null && palletTypeInfoDepth.LocaitonCount != palletTypeInfo.LocaitonCount)
                                {
                                    continue;
                                }
                                if (locationInfoExist.LocationStatus != LocationStatusEnum.Free.ObjToInt() || locationInfoExist.EnableStatus != EnableStatusEnum.Normal.ObjToInt())
                                {
                                    continue;
                                }
                            }
                            locationCaches_ZH.Add(new LocationCache { LocationCode = locationInfo.LocationCode, DateTime = DateTime.Now });
                            return locationInfo;
                        }
@@ -100,6 +152,57 @@
                        Dt_LocationInfo? locationInfo = GetUsableLocation_ZH(locationInfos, definedTypeEmptyLocation, palletType);
                        if (locationInfo != null)
                        {
                            if (locationInfo.Depth < locationInfoDepth.Max(x => x.Depth))
                            {
                                Dt_LocationInfo? locationInfoExist = null;
                                int Column = locationInfo.Column;
                                if (locationInfo.Row - locationInfo.Depth == locationInfo.Depth)
                                {
                                    locationInfoExist = locationInfoDepth.FirstOrDefault(x => x.Row == (locationInfo.Row - 1) && x.Column == Column && x.Layer == locationInfo.Layer);
                                }
                                else
                                {
                                    locationInfoExist = locationInfoDepth.FirstOrDefault(x => x.Row == (locationInfo.Row + 1) && x.Column == Column && x.Layer == locationInfo.Layer);
                                }
                                //获取深位货位类型
                                if (locationInfoExist == null)
                                {
                                    continue;
                                }
                                Dt_PalletTypeInfo palletTypeInfoDepth = _basicRepository.PalletTypeInfoRepository.QueryFirst(x => x.WarehouseId == locationInfoExist.WarehouseId && x.PalletType == locationInfoExist.LocationType);
                                if (palletTypeInfoDepth != null && palletTypeInfoDepth.LocaitonCount != palletTypeInfo.LocaitonCount)
                                {
                                    continue;
                                }
                            }
                            else
                            {
                                Dt_LocationInfo? locationInfoExist = null;
                                int Column = locationInfo.Column;
                                if (locationInfo.Row % 2 == 0)
                                {
                                    locationInfoExist = locationInfoDepth.FirstOrDefault(x => x.Row == (locationInfo.Row - 1) && x.Column == Column && x.Layer == locationInfo.Layer);
                                }
                                else
                                {
                                    locationInfoExist = locationInfoDepth.FirstOrDefault(x => x.Row == (locationInfo.Row + 1) && x.Column == Column && x.Layer == locationInfo.Layer);
                                }
                                //获取深位货位类型
                                if (locationInfoExist == null)
                                {
                                    continue;
                                }
                                Dt_PalletTypeInfo palletTypeInfoDepth = _basicRepository.PalletTypeInfoRepository.QueryFirst(x => x.WarehouseId == locationInfoExist.WarehouseId && x.PalletType == locationInfoExist.LocationType);
                                if (palletTypeInfoDepth != null && palletTypeInfoDepth.LocaitonCount != palletTypeInfo.LocaitonCount)
                                {
                                    continue;
                                }
                                if (locationInfoExist.LocationStatus != LocationStatusEnum.Free.ObjToInt() || locationInfoExist.EnableStatus != EnableStatusEnum.Normal.ObjToInt())
                                {
                                    continue;
                                }
                            }
                            locationCaches_ZH.Add(new LocationCache { LocationCode = locationInfo.LocationCode, DateTime = DateTime.Now });
                            return locationInfo;
                        }