Admin
8 天以前 96a77e69b0577c50adfaacd5fd8b89009242d3bd
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Base/LocationInfoService.cs
@@ -139,7 +139,7 @@
        {
            lock (_locker)
            {
                List<LocationCache> removeItems = locationCaches.Where(x => (DateTime.Now - x.DateTime).TotalMinutes > 20).ToList();//查询添加静态变量超过5分钟的货位
                List<LocationCache> removeItems = locationCaches.Where(x => (DateTime.Now - x.DateTime).TotalMinutes > 3).ToList();//查询添加静态变量超过5分钟的货位
                int count = removeItems.Count;
                for (int i = 0; i < count; i++)
                {
@@ -370,5 +370,64 @@
            public DateTime DateTime { get; set; }
        }
        /*public WebResponseContent RetrieveStorageLocationInformation()
        {
            List<Dt_LocationInfo> dt_Locations = BaseDal.QueryData();
            //获取成品库位数量(æ·±)
            List<Dt_LocationInfo> Shallowlocation = dt_Locations.Where(x => x.RoadwayNo == "1" && x.LocationStatus == LocationStatusEnum.Free.ObjToInt()&& x.EnableStatus == (int)EnableStatusEnum.Normal && x.Layer <= 9 && x.Depth==1).ToList();
            List<Dt_LocationInfo> Finishedlocation = dt_Locations.Where(x => x.RoadwayNo == "1" && x.LocationStatus == LocationStatusEnum.Free.ObjToInt()&& x.EnableStatus == (int)EnableStatusEnum.Normal && x.Layer <= 9 && x.Depth == 2).ToList();
            //获取14-37列库位数量
            //获取空托库位数量
            //获取原材料库位数量
            //获取空托数量
        }*/
        public WebResponseContent RetrieveStorageLocationInformation()
        {
            // 1. æŸ¥æ‰¾æ·±åº“位
            List<Dt_LocationInfo> dt_Locations = BaseDal.QueryData(
                x => x.RoadwayNo == "1"
                    && x.EnableStatus == 0
                    && x.LocationStatus == 0
                    && x.Depth == 2
                    && x.Layer <= 9
            );
            if (dt_Locations == null || !dt_Locations.Any())
            {
                return WebResponseContent.Instance.OK(new List<string>().ToJson());
            }
            // 2. æŸ¥è¯¢æ‰€æœ‰æµ…库位
            var allShallow = BaseDal.QueryData(
                x => x.RoadwayNo == "1" && x.Depth == 1
            );
            List<string> locationCodes = new List<string>();
            if (allShallow != null)
            {
                // åœ¨å†…存中过滤并提取LocationCode
                locationCodes = allShallow
                    .Where(x =>
                        dt_Locations.Any(deep =>
                            deep.Layer == x.Layer
                            && deep.RoadwayNo == x.RoadwayNo
                            && deep.Column == x.Column
                            && ((deep.Row == 1 && x.Row == 2) || (deep.Row != 1 && x.Row == 3))
                        )
                        && x.LocationStatus != 0
                    )
                    .Select(x => x.LocationCode)  // åªé€‰æ‹©LocationCode字段
                    .ToList();
            }
            return WebResponseContent.Instance.OK(locationCodes.ToJson());
        }
    }
}