예제 #1
0
        }                                                                              //goal of this is to mark cascaded instance errors as warnings

        private void build_error_list(int[] compare, component edif, DataRow partmast) //overload for pcmrp
        {
            string[] errors = new string[6] {
                "Aux ", "Footprint ", "Value ", "Package ", "Temperature ", "ModelNo "
            };

            for (int i = 0; i < compare.Length; i++)
            {
                if (compare[i] != 1)
                {
                    string        error    = errors[i] + generate_error(compare[i]);
                    part_mismatch mismatch = new part_mismatch(edif, partmast, error);
                    error_list.Add(mismatch);
                }                                                                   //if its wrong
            }                                                                       //go through compare list
        }                                                                           //if there is a false then adds to error_list and fills the data.
예제 #2
0
        }                                                                           //if there is a false then adds to error_list and fills the data.

        private void build_error_list(int[] compare, component edif, component bom) //overload for bom
        {
            string[] errors = new string[2] {
                "Instance ", "Instance Names "
            };

            for (int i = 0; i < compare.Length; i++)
            {
                if (compare[i] != 1)
                {
                    string        error    = errors[i] + generate_error(compare[i]);
                    part_mismatch mismatch = new part_mismatch(edif, bom, error);
                    error_list.Add(mismatch);
                } //if its wrong
            }     //go through compare list
        }         //if there is a false then adds to error_list and fills the data.
예제 #3
0
        }             //compare bom part numbers and names with edif names/instances of components

        private void partmast_compare()
        {
            foreach (component component in edif_list)
            {
                int[]   compare = new int[6];
                string  partno  = component.partno.ToUpper();
                DataRow datarow = partmast_data.NewRow();                 //placeholder row to use conditional below
                if (partno != "")
                {
                    datarow = partmast_data.Select("partno = '" + partno + "'")[0];
                }
                else
                {
                    string error = "Partno missing from entry \"" + component.name + "\" in EDIF file.";
                    Console.WriteLine(error);
                    part_mismatch name_missing = new part_mismatch(error);
                }


                //pass both edif and partmast values into unit parse then compare
                if (component.checks[0] || component.checks[1])
                {
                    if (component.type == 'C' || component.type == 'F')
                    {
                        if (component.checks[0])                         //auxv
                        {
                            compare[0] = compare_values(unit_parse(component.value), unit_parse(datarow[1].ToString()));
                        }
                        else
                        {
                            compare[0] = 1;
                        }
                    }
                    if (component.type == 'R')
                    {
                        if (component.checks[1])                         //auxw
                        {
                            compare[0] = compare_values(unit_parse(component.value), unit_parse(datarow[2].ToString()));
                        }
                        else
                        {
                            compare[0] = 1;
                        }
                    }
                }
                else
                {
                    compare[0] = 1;                     //if it is not the type with an aux, then skip over it
                }
                if (component.checks[2])                //footprint
                {
                    if (datarow[3].ToString().Contains(';'))
                    {
                        var split = datarow[3].ToString().Split(';');
                        int one   = compare_values(component.footprint, remove_whitespace(split[0]));
                        int two   = compare_values(component.footprint, remove_whitespace(split[1]));

                        if (one == 1 || two == 1)
                        {
                            compare[5] = 1;
                        }
                        else if (one == -1 && two == -1)
                        {
                            compare[5] = -1;
                        }
                        else
                        {
                            compare[5] = 0;
                        }
                    }
                    else
                    {
                        compare[1] = compare_values(component.footprint, datarow[3].ToString());                         //footprint mrp and footprint edif
                    }
                }
                else
                {
                    compare[1] = 1;
                }
                if (component.checks[3])                                                                           //value
                {
                    compare[2] = compare_values(unit_parse(component.comment), unit_parse(datarow[4].ToString())); //value mrp and comment edif
                }
                else
                {
                    compare[2] = 1;
                }
                if (component.checks[4])                                                   //package
                {
                    compare[3] = compare_values(component.package, datarow[5].ToString()); //packtype mrp and package edif
                }
                else
                {
                    compare[3] = 1;
                }
                if (component.checks[5])                                                //temperature
                {
                    compare[4] = compare_values(component.temp, datarow[6].ToString()); //rating mrp and temperature edif
                }
                else
                {
                    compare[4] = 1;
                }
                if (component.checks[6])                 //modelno
                {
                    if (component.type == 'S')
                    {
                        int one = compare_values(component.modelno, datarow[7].ToString());
                        int two = compare_values(component.modelno, datarow[3].ToString());
                        if (one == 1 || two == 1)
                        {
                            compare[5] = 1;
                        }
                        else
                        {
                            compare[5] = one;
                        }
                    }                    //socket has to compare modleno edif to modelno mrp OR footprint mrp
                    else
                    {
                        compare[5] = compare_values(component.modelno, datarow[7].ToString());                         //modelno mrp and modelno edif -> normal
                    }
                }
                else
                {
                    compare[5] = 1;
                }

                if (compare.Contains(-1) || compare.Contains(0))
                {
                    Console.WriteLine(component.name);
                }

                build_error_list(compare, component, datarow); //scans through the bools, and adds to the error list if necessary.
            }
        }                                                      //compare partmast values with edif values of components