private List <string> GetPartyList(string planType, string userCode) { List <string> partyList = new List <string>(); if (planType == BusinessConstants.CODE_MASTER_PLAN_TYPE_VALUE_DMDSCHEDULE) { IList <Customer> custList = CustomerMgr.GetCustomer(userCode); if (custList != null && custList.Count > 0) { foreach (Customer cust in custList) { partyList.Add(cust.Code); } } } else if (planType == BusinessConstants.CODE_MASTER_PLAN_TYPE_VALUE_MPS) { IList <Region> regionList = RegionMgr.GetRegion(userCode); if (regionList != null && regionList.Count > 0) { foreach (Region region in regionList) { partyList.Add(region.Code); } } } else if (planType == BusinessConstants.CODE_MASTER_PLAN_TYPE_VALUE_MRP) { IList <Supplier> supList = SupplierMgr.GetSupplier(userCode); if (supList != null && supList.Count > 0) { foreach (Supplier sup in supList) { partyList.Add(sup.Code); } } } return(partyList); }
public IList <LocationDetail> FindLocationDetail(IList <string> locationCode, IList <string> itemCode, DateTime?effectiveDate, string userCode, bool includeActiveOrder, int pageSize, int pageIndex) { IList <LocationDetail> ldList = new List <LocationDetail>(); IList <Region> regionList = RegionMgr.GetRegion(userCode); IList <Location> locList = new List <Location>(); IList <Location> inputLocList = this.LocationMgr.GetLocation(locationCode); if (inputLocList != null && inputLocList.Count > 0) { foreach (Location location in inputLocList) { if (regionList != null && regionList.Count > 0 && regionList.IndexOf(location.Region) < 0) { continue; } locList.Add(location); } } else { locList = LocationMgr.GetLocationByUserCode(userCode); } if (pageSize > 0 && pageIndex < 1) { throw new TechnicalException("CurrentPage can't less than 1"); } int totalCount = 0; int fromCount = (pageIndex - 1) * pageSize; int toCount = pageIndex * pageSize; if (locList != null && locList.Count > 0) { IList <Item> itemList = this.ItemMgr.GetItem(itemCode); IList <Item> newItemList = new List <Item>(); foreach (Location location in locList) { if (pageSize > 0 && totalCount >= toCount) { break; } newItemList = new List <Item>(); IList <LocationDetail> preldList = this.GetLocationDetailList(location.Code, null); if (preldList != null && preldList.Count > 0) { foreach (LocationDetail preld in preldList) { if (itemList == null || itemList.Count == 0 || itemList.Contains(preld.Item)) { if (preld.ConsignmentQty != 0 || preld.NormalQty != 0 || preld.InvQty != 0 || preld.QtyToBeIn != 0 || preld.InTransitQty != 0 || preld.QtyToBeOut != 0 || preld.PAB != 0) { newItemList.Add(preld.Item); } } } } if (newItemList != null && newItemList.Count > 0) { foreach (Item item in newItemList) { if (pageSize > 0 && totalCount >= toCount) { break; } totalCount++; if (pageSize == 0 || totalCount > fromCount) { LocationDetail ld = this.FindLocationDetail(location, item, effectiveDate, includeActiveOrder); if (ld != null) { ldList.Add(ld); } } } } } } return(ldList); }