diff --git a/Vue.Net/VOL.WMS/Services/WMSINPLAN/Partial/VW_OP_WMS_IN_PLANService.cs b/Vue.Net/VOL.WMS/Services/WMSINPLAN/Partial/VW_OP_WMS_IN_PLANService.cs index fcbffd30..b4f92f79 100644 --- a/Vue.Net/VOL.WMS/Services/WMSINPLAN/Partial/VW_OP_WMS_IN_PLANService.cs +++ b/Vue.Net/VOL.WMS/Services/WMSINPLAN/Partial/VW_OP_WMS_IN_PLANService.cs @@ -17,6 +17,9 @@ using Microsoft.EntityFrameworkCore; using VOL.Core.ManageUser; using System.Collections.Generic; using System; +using ConvertHelper; +using VOL.System.Repositories; +using VOL.WMS.Repositories; namespace VOL.WMS.Services { @@ -60,22 +63,45 @@ namespace VOL.WMS.Services //queryable = queryable.DataFilterExtension(); - if (UserContext.Current.UserInfo.LimitInCompany) - { - //IQueryable userQuery = RoleContext.GetCurrentAllChildUser(); + //if (UserContext.Current.UserInfo.LimitInCompany) + //{ + // //IQueryable userQuery = RoleContext.GetCurrentAllChildUser(); - queryable = queryable.Where(x => x.CORPID == UserContext.Current.UserInfo.CompanyId); - } + // queryable = queryable.Where(x => x.CORPID == UserContext.Current.UserInfo.CompanyId); + //} - //如果该用户角色受仓库权限限制 ,则必须 - if (UserContext.Current.UserInfo.LimitBySTORAGE) - { - //IQueryable userQuery = RoleContext.GetCurrentAllChildUser(); + ////如果该用户角色受仓库权限限制 ,则必须 + //if (UserContext.Current.UserInfo.LimitBySTORAGE) + //{ + // //IQueryable userQuery = RoleContext.GetCurrentAllChildUser(); - queryable = queryable.Where(x => (UserContext.Current.UserInfo.STOREHOUSEList.Contains(x.STOREHOUSE)) || (x.STOREHOUSE == "" || x.STOREHOUSE == null)); + // queryable = queryable.Where(x => (UserContext.Current.UserInfo.STOREHOUSEList.Contains(x.STOREHOUSE)) || (x.STOREHOUSE == "" || x.STOREHOUSE == null)); + //} + var list = queryable.DataFilter(); + if (list[0].Count > 0) + { + queryable = queryable.Where(list[0].AsExpression(Query.Condition.AndAlso)); + } + if (list[1].Count > 0) + { + queryable = queryable.Where(list[1].AsExpression(Query.Condition.OrElse)); } - //queryable = queryable.Where(x => x.BSSOURCE == "入库受理" || (x.BSSOURCE == "入库计划" && x.BILLSTATUS!="1000") || x.BSSOURCE == "贸易公司" ); + #region 处理箱号查询 + var CNTRNO = string.Empty; + var searchParametersList = options.Wheres.DeserializeObject>(); + if (searchParametersList.Exists(x => x.Name == "CNTRNO")) + { + CNTRNO = searchParametersList.First(x => x.Name == "CNTRNO").Value; + + var goodslist = OP_WMS_IN_PLAN_GOODSRepository.Instance.FindAsIQueryable(x => x.CNTRNO.Contains(CNTRNO)).Select(n => n.WMSPLANID).Distinct().ToList(); + + if (goodslist.Count > 0) + { + queryable = queryable.Where(x => (goodslist.Contains(x.WMSPLANID))); + } + } + #endregion return queryable; };