private void cachePOLine() { XPClassInfo poLineClass = uow.GetClassInfo(typeof(PurchOrderLine)); CriteriaOperator criteria = CriteriaOperator.Parse(string.Format("(OrderStatus = '{0}' OR OrderStatus = '{1}' OR OrderStatus = '{2}') ", PurchOrderLine.PurchOrderStatus.Approval, PurchOrderLine.PurchOrderStatus.Waiting, PurchOrderLine.PurchOrderStatus.Active)); SortingCollection sortProps = new SortingCollection(null); sortProps.Add(new SortProperty("NeedDate", SortingDirection.Ascending)); ICollection purchOrderLines = uow.GetObjects(poLineClass, criteria, sortProps, int.MaxValue, false, true); XPCollection<WIPPurchOrderLine> poLines; WIPPurchOrderLine poLine; foreach (PurchOrderLine purchOrderLine in purchOrderLines) { string itemNo = purchOrderLine.Item.ItemNo; poLine = new WIPPurchOrderLine(uow, purchOrderLine); poLine.WIPTable = wipTable; poLine.Save(); if (dictPoLine.ContainsKey(itemNo)) { poLines = dictPoLine[itemNo]; poLines.Add(poLine); } else { poLines = new XPCollection<WIPPurchOrderLine>(uow, false); poLines.Add(poLine); dictPoLine.Add(itemNo, poLines); } } }
private void cachePOLine() { XPClassInfo poLineClass; CriteriaOperator criteria; SortingCollection sortProps; poLineClass = uow.GetClassInfo(typeof(PurchOrderLine)); // Move QAQty to WHTotal //criteria = CriteriaOperator.Parse(string.Format("(OrderStatus = '{0}' OR OrderStatus = '{1}' OR OrderStatus = '{2}' OR PendingReceivedQty > 0 ) ", PurchOrderLine.PurchOrderStatus.Approval, PurchOrderLine.PurchOrderStatus.Waiting, PurchOrderLine.PurchOrderStatus.Active)); criteria = CriteriaOperator.Parse(string.Format("(OrderStatus = '{0}' OR OrderStatus = '{1}' OR OrderStatus = '{2}' ) ", PurchOrderLine.PurchOrderStatus.Approval, PurchOrderLine.PurchOrderStatus.Waiting, PurchOrderLine.PurchOrderStatus.Active)); sortProps = new SortingCollection(null); sortProps.Add(new SortProperty("NeedDate", SortingDirection.Ascending)); ICollection purchOrderLines = uow.GetObjects(poLineClass, criteria, sortProps, int.MaxValue, false, true); XPCollection<WIPPurchOrderLine> poLines; WIPPurchOrderLine poLine; foreach (PurchOrderLine purchOrderLine in purchOrderLines) { string key; key = purchOrderLine.Item.ItemNo + "_" + purchOrderLine.OrderType.Name; poLine = new WIPPurchOrderLine(Session, purchOrderLine); poLine.WIPTable = wipTable; poLine.Save(); if (dictPoLine.ContainsKey(key)) { poLines = dictPoLine[key]; poLines.Add(poLine); } else { poLines = new XPCollection<WIPPurchOrderLine>(Session, false); poLines.Add(poLine); dictPoLine.Add(key, poLines); } } }