huangxiaoqiang
17 小时以前 e483ac11616ffc9260d8f491fcc0d66f480b5443
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageBasicServices/Stock/StockInfoService.cs
@@ -90,50 +90,46 @@
            catch { }
        }
        Expression<Func<DtStockInfo, bool>> locationStatus = null;
        Expression<Func<DtStockInfo, bool>> floor = null;
        Expression<Func<DtStockInfo, bool>> areaId = null;
        Expression<Func<DtStockInfo, bool>> materielCode = null;
        Expression<Func<DtStockInfo, bool>> materielName = null;
        Expression<Func<DtStockInfo, bool>> demandClassification = null;
        foreach (var item in searchParametersList)
        {
            if (item.Name.Contains("locationStatus"))
            {
                locationStatus = x => x.LocationInfo.LocationStatus == Convert.ToInt32(item.Value);
            }
            else if (item.Name.Contains("floor"))
            {
                floor = x => x.LocationInfo.Floor.Contains(item.Value);
            }
            else if (item.Name.Contains("areaId"))
            {
                areaId = x => x.LocationInfo.AreaId == Convert.ToInt32(item.Value);
            }
            else if (item.Name.Contains("materielCode"))
            {
                materielCode = x => x.StockInfoDetails.Any(d => d.MaterielCode.Contains(item.Value));
            }
            else if (item.Name.Contains("materielName"))
            {
                materielName = x => x.StockInfoDetails.Any(d => d.MaterielName.Contains(item.Value));
            }
            else if (item.Name.Contains("demandClassification"))
            {
                demandClassification = x => x.StockInfoDetails.Any(d => d.DemandClassification.Contains(item.Value));
            }
        }
        //Expression<Func<DtStockInfo, bool>> locationStatus = null;
        //Expression<Func<DtStockInfo, bool>> floor = null;
        //Expression<Func<DtStockInfo, bool>> areaId = null;
        //Expression<Func<DtStockInfo, bool>> materielCode = null;
        //Expression<Func<DtStockInfo, bool>> materielName = null;
        //Expression<Func<DtStockInfo, bool>> demandClassification = null;
        //foreach (var item in searchParametersList)
        //{
        //    if (item.Name.Contains("locationStatus"))
        //    {
        //        locationStatus = x => x.LocationInfo.LocationStatus == Convert.ToInt32(item.Value);
        //    }
        //    else if (item.Name.Contains("areaId"))
        //    {
        //        areaId = x => x.LocationInfo.AreaId == Convert.ToInt32(item.Value);
        //    }
        //    else if (item.Name.Contains("materielCode"))
        //    {
        //        materielCode = x => x.StockInfoDetails.Any(d => d.MaterielCode.Contains(item.Value));
        //    }
        //    else if (item.Name.Contains("materielName"))
        //    {
        //        materielName = x => x.StockInfoDetails.Any(d => d.MaterielName.Contains(item.Value));
        //    }
        //    else if (item.Name.Contains("demandClassification"))
        //    {
        //        demandClassification = x => x.StockInfoDetails.Any(d => d.DemandClassification.Contains(item.Value));
        //    }
        //}
        //.IncludesAllFirstLayer()
        var data = BaseDal.Db.Queryable<DtStockInfo>()
            .Includes(x => x.StockInfoDetails)
            .Includes(x => x.LocationInfo)
            //.Includes(x => x.StockInfoDetails)
            //.Includes(x => x.LocationInfo)
            .WhereIF(!wheres.IsNullOrEmpty(), wheres)
            .WhereIF(locationStatus != null, locationStatus)
            .WhereIF(floor != null, floor)
            .WhereIF(areaId != null, areaId)
            .WhereIF(materielCode != null, materielCode)
            .WhereIF(materielName != null, materielName)
            .WhereIF(demandClassification != null, demandClassification)
            //.WhereIF(locationStatus != null, locationStatus)
            //.WhereIF(floor != null, floor)
            //.WhereIF(areaId != null, areaId)
            //.WhereIF(materielCode != null, materielCode)
            //.WhereIF(materielName != null, materielName)
            //.WhereIF(demandClassification != null, demandClassification)
            .OrderBy(orderByModels)
            .ToPageList(options.Page, options.Rows, ref totalCount);
        new PageGridData<DtStockInfo>(totalCount, data);