Ejemplo n.º 1
0
        //public List<string> GetUomCodes()
        //{
        //    ArrayList filter = new ArrayList(1);
        //    filter.Add(new ArrayList(3) { "code", "!=", false });
        //    ArrayList ids = oObject.Search("product.uom", filter);
        //    ArrayList records = oObject.Read("product.uom", ids, new ArrayList(1) { "code" });

        //    List<string> uoms = new List<string>();
        //    foreach (Hashtable record in records)
        //    {
        //        if (!uoms.Contains((string)record["code"]))
        //            uoms.Add((string)record["code"]);
        //    }
        //    return uoms;
        //}

        public List <string> GetRouteTemplates()
        {
            ArrayList filter = new ArrayList(1);

            filter.Add(new ArrayList(3)
            {
                "name", "like", "_template"
            });
            ArrayList ids     = oObject.Search("mrp.routing", filter);
            ArrayList records = oObject.Read("mrp.routing", ids, new ArrayList(1)
            {
                "name"
            });

            List <string> routes = new List <string>();

            foreach (Hashtable record in records)
            {
                if (!routes.Contains((string)record["name"]))
                {
                    routes.Add((string)record["name"]);
                }
            }
            routes.Sort();
            return(routes);
        }
Ejemplo n.º 2
0
        private DataTable GetEcos()
        {
            ecoTable = GetEcoDataTable();
            if (this.versionIds.Count == 0)
            {
                return(ecoTable);
            }

            ArrayList filter = new ArrayList();

            filter.Add(new ArrayList(3)
            {
                "product_id", "in", this.versionIds
            });
            ArrayList ids = oClient.Search("ecm.eco.rev.line", filter);

            ArrayList fields = new ArrayList()
            {
                "eco_id", "new_rev", "zone", "description", "target_date", "owner_id"
            };
            ArrayList records = oClient.Read("ecm.eco.rev.line", ids, fields);

            foreach (Hashtable rec in records)
            {
                DataRow row = ecoTable.NewRow();
                row["Eco"]         = (string)((ArrayList)rec["eco_id"])[1];
                row["Rev"]         = (string)rec["new_rev"];
                row["Zone"]        = rec["zone"].GetType() == Type.GetType("System.Boolean") ? "" : (string)rec["zone"];
                row["Description"] = rec["description"].GetType() == Type.GetType("System.bool") ? "" : (string)rec["description"];
                row["Date"]        = (string)rec["target_date"];
                row["Owner"]       = (string)((ArrayList)rec["owner_id"])[1];
                ecoTable.Rows.Add(row);
            }
            ecoTable.DefaultView.Sort = "Eco ASC";

            return(ecoTable);
        }