private void cacheProdRouteQAQty() { XPClassInfo rListTransferClass; CriteriaOperator criteria; SortingCollection sortProps; rListTransferClass = uow.GetClassInfo(typeof(ProdRouteListTransfer)); criteria = CriteriaOperator.Parse(string.Format("(Status = '{0}' ) ", ProdRouteListTransfer.ProdRouteListStatus.Waiting)); sortProps = new SortingCollection(null); ICollection rListTransfers = uow.GetObjects(rListTransferClass, criteria, sortProps, int.MaxValue, false, true); foreach (ProdRouteListTransfer rListTransfer in rListTransfers) { if (rListTransfer.ToProdRoute == null) { string itemNo; itemNo = rListTransfer.ProdOrder.Item.ItemNo; WIPWHTotal wipWHTotal = GetWHTotal(itemNo, rListTransfer.ProdOrder.Warehouse); if (wipWHTotal != null) { wipWHTotal.QAQty = wipWHTotal.QAQty + rListTransfer.Qty + rListTransfer.ScrapQty; } else { wipWHTotal = new WIPWHTotal(Session, rListTransfer); wipWHTotal.WIPTable = wipTable; wipWHTotal.QAQty = wipWHTotal.QAQty + rListTransfer.Qty + rListTransfer.ScrapQty; wipWHTotal.Save(); } XPCollection<WIPWHTotal> wipWHTotals; if (dictWHTotal.ContainsKey(itemNo)) { wipWHTotals = dictWHTotal[itemNo]; wipWHTotals.Add(wipWHTotal); } else { wipWHTotals = new XPCollection<WIPWHTotal>(Session, false); wipWHTotals.Add(wipWHTotal); dictWHTotal.Add(itemNo, wipWHTotals); } } } }
private void cacheWHTotal() { XPClassInfo whTotalClass = uow.GetClassInfo(typeof(WHTotal)); CriteriaOperator criteria = CriteriaOperator.Parse(""); SortingCollection sortProps = new SortingCollection(null); //criteria = CriteriaOperator.Parse(string.Format("(ProdOrder.OrderStatus = '{0}') ", ProdOrder.ProdOrderStatus.Active)); //sortProps.Add(new SortProperty("NeedDate", SortingDirection.Descending)); ICollection whTotals = uow.GetObjects(whTotalClass, criteria, sortProps, int.MaxValue, false, true); XPCollection<WIPWHTotal> wipWHTotals; WIPWHTotal wipWHTotal; string key; foreach (WHTotal whTotal in whTotals) { wipWHTotal = new WIPWHTotal(uow, whTotal); wipWHTotal.WIPTable = wipTable; wipWHTotal.Save(); key = wipWHTotal.Item.ItemNo; if (dictWHTotal.ContainsKey(key)) { wipWHTotals = dictWHTotal[key]; wipWHTotals.Add(wipWHTotal); } else { wipWHTotals = new XPCollection<WIPWHTotal>(uow, false); wipWHTotals.Add(wipWHTotal); dictWHTotal.Add(key, wipWHTotals); } wipWHTotals.Add(wipWHTotal); } }
private void cachePOLineQAQty() { XPClassInfo poReceiveClass; CriteriaOperator criteria; SortingCollection sortProps; poReceiveClass = uow.GetClassInfo(typeof(PurchOrderReceive)); criteria = CriteriaOperator.Parse(string.Format("(Status = '{0}' ) ", PurchOrderReceive.OrderReceiveStatus.Waiting)); sortProps = new SortingCollection(null); ICollection poReceives = uow.GetObjects(poReceiveClass, criteria, sortProps, int.MaxValue, false, true); foreach (PurchOrderReceive poReceive in poReceives) { string key; key = poReceive.PurchOrderLine.Item.ItemNo ; WIPWHTotal wipWHTotal = GetWHTotal(key, poReceive.PurchOrderLine.Warehouse); if (wipWHTotal != null) { wipWHTotal.QAQty = wipWHTotal.QAQty + poReceive.Qty + poReceive.ScrapQty; } else { wipWHTotal = new WIPWHTotal(Session, poReceive); wipWHTotal.QAQty = wipWHTotal.QAQty + poReceive.Qty + poReceive.ScrapQty; wipWHTotal.Save(); } XPCollection<WIPWHTotal> wipWHTotals; if (dictWHTotal.ContainsKey(key)) { wipWHTotals = dictWHTotal[key]; wipWHTotals.Add(wipWHTotal); } else { wipWHTotals = new XPCollection<WIPWHTotal>(Session, false); wipWHTotal.WIPTable = wipTable; wipWHTotals.Add(wipWHTotal); dictWHTotal.Add(key, wipWHTotals); } } }