Ejemplo n.º 1
0
        private void cacheProdRoute()
        {
            XPClassInfo prodRouteClass = uow.GetClassInfo(typeof(ProdRoute));
            CriteriaOperator criteria = CriteriaOperator.Parse(string.Format("(ProdOrder.OrderStatus = '{0}' && WipQty > 0) ", ProdOrder.ProdOrderStatus.Active));
            SortingCollection sortProps = new SortingCollection(null);
            string key;

            ICollection prodRoutes = uow.GetObjects(prodRouteClass, criteria, sortProps, int.MaxValue, false, true);
            XPCollection<WIPProdRoute> pRoutes;
            WIPProdRoute pRoute;

            foreach (ProdRoute prodRoute in prodRoutes)
            {
                pRoute = new WIPProdRoute(uow, prodRoute);
                pRoute.WIPTable = wipTable;
                pRoute.Save();
                key = String.Format("{0}_{1}", pRoute.ProdRoute.Item.ItemNo, pRoute.ProdRoute.WorkOper.Name);

                if (pRoute.Qty > 0)
                {
                    if (dictProdRoute.ContainsKey(key))
                    {
                        pRoutes = dictProdRoute[key];
                        pRoutes.Add(pRoute);
                    }
                    else
                    {
                        pRoutes = new XPCollection<WIPProdRoute>(uow, false);
                        pRoutes.Add(pRoute);
                        dictProdRoute.Add(key, pRoutes);
                    }
                }
            }
        }
Ejemplo n.º 2
0
        private void cacheProdRoute()
        {
            XPClassInfo prodRouteClass;
            CriteriaOperator criteria;
            SortingCollection sortProps;
            string key;

            prodRouteClass = uow.GetClassInfo(typeof(ProdRoute));
            criteria = CriteriaOperator.Parse(string.Format("(ProdOrder.OrderStatus = '{0}' && WipQty > 0) ", ProdOrder.ProdOrderStatus.Active));
            sortProps = new SortingCollection(null);
            //sortProps.Add(new SortProperty("NeedDate", SortingDirection.Ascending));

            ICollection prodRoutes = uow.GetObjects(prodRouteClass, criteria, sortProps, int.MaxValue, false, true);
            XPCollection<WIPProdRoute> pRoutes;
            WIPProdRoute pRoute;

            foreach (ProdRoute prodRoute in prodRoutes )
            {
                pRoute = new WIPProdRoute(Session, prodRoute);

                if (pRoute.Qty > 0)
                {
                    pRoute.WIPTable = wipTable;
                    pRoute.Save();
                    key = pRoute.ProdRoute.Item.ItemNo + "_" + pRoute.ProdRoute.ProdOrder.OrderType.Name  +"_" + pRoute.ProdRoute.WorkOper.Name;

                    if (dictProdRoute.ContainsKey(key))
                    {
                        pRoutes = dictProdRoute[key];
                        pRoutes.Add(pRoute);
                    }
                    else
                    {
                        pRoutes = new XPCollection<WIPProdRoute>(Session, false);
                        pRoutes.Add(pRoute);
                        dictProdRoute.Add(key, pRoutes);
                    }
                }
                else
                {
                    pRoute.Delete();
                }
            }
        }