private bool RemoveInvalidChildren(InventoryItem item) { InventoryItemPCExt itemPCExt = item.GetExtension <InventoryItemPCExt>(); string parentCD = null; bool result = true; if (itemPCExt != null && itemPCExt.UsrKNCompositeID != null) { parentCD = Graph.ItemById.SelectSingle(itemPCExt.UsrKNCompositeID).InventoryCD; } if (parentCD != null) { result = InputList.Any(x => x.InventoryCD == parentCD); if (!result) { return(result); } } if (item.StkItem.GetValueOrDefault()) { PXResultset <INKitSpecStkDet> stockComponents = Graph.StockKitComponentsExisted.Select(item.InventoryID); foreach (INKitSpecStkDet comp in stockComponents) { string revisionId = Graph.KitProduct.SelectSingle(comp.KitInventoryID)?.RevisionID; if (comp.RevisionID == revisionId) { result = InputList.Any(x => x.InventoryID == comp.KitInventoryID.Value); } if (result) { return(result); } } } else { PXResultset <INKitSpecNonStkDet> nonStockComponents = Graph.NonStockKitComponentsExisted.Select(item.InventoryID); foreach (INKitSpecNonStkDet comp in nonStockComponents) { string revisionId = Graph.KitProduct.SelectSingle(comp.KitInventoryID)?.RevisionID; if (comp.RevisionID == revisionId) { result = InputList.Any(x => x.InventoryID == comp.KitInventoryID.Value); } if (result) { return(result); } } } return(result); }
public BatchIOConfigSectionViewModel( BatchIOConfigSection view) { _view = view; _isInputListSelected = this .WhenAnyValue(x => x.SelectedInput) .Select(x => x is not null) .ToProperty(this, x => x.IsInputListSelected); _hasInvalidCharHelper = InputList .ObserveCollectionChanges() .Select(_ => InputList.Any(x => PathExtension.InvalidChars.Any(x.Contains) || x.Length > 90)) .ToProperty(this, x => x.HasInvalidChar); }
/// <summary> /// Check whether sum of Quantities of the Grouped Items' and Kits' children is bigger than 1. /// </summary> /// <param name="inventoryItem">InventoryItem that should be checked</param> /// <returns>Validation result</returns> private bool HasMoreThanOneQuantity(InventoryItem inventoryItem) { decimal sum = 2; InventoryItemPCExt itemPcExt = inventoryItem.GetExtension <InventoryItemPCExt>(); if (itemPcExt?.UsrKNCompositeType == KCConstants.GroupedProduct) { IEnumerable <KNSIGroupedItems> children = Graph.GroupedItemChilds.Select(inventoryItem.InventoryID)?.RowCast <KNSIGroupedItems>(); // 06/05/19 AT: InputList contains only those items, that are valid for ChannelAdvisor(excluding this rule). // We need to take into account only those children, which are valid for Export. // The intersection of children and InputList will give us the desired list. children = children.Where(child => InputList.Any(validatedItems => validatedItems.InventoryID == child.MappedInventoryID)); sum = children != null?children.Sum(x => x.Quantity.GetValueOrDefault()) : 0; } else if (inventoryItem.KitItem.GetValueOrDefault()) { string revisionId = Graph.KitProduct.SelectSingle(inventoryItem.InventoryID)?.RevisionID; sum = (decimal)Graph.StockKitComponents.Select(inventoryItem.InventoryID, revisionId)?.RowCast <INKitSpecStkDet>()?.Sum(x => x.DfltCompQty.GetValueOrDefault()); sum += (decimal)Graph.NonStockKitComponents.Select(inventoryItem.InventoryID, revisionId)?.RowCast <INKitSpecNonStkDet>()?.Sum(x => x.DfltCompQty.GetValueOrDefault()); } return(sum > 1); }
/// <summary> /// Check exist a named input object /// </summary> public bool HasInput(string name) { return(InputList.Any(t => name.Equals(t.Name))); }