Beispiel #1
0
        private static string getOUTPUTRATE(txtTablesLib.simpleTableTests table, txtTablesLib.textRules rules)
        {
            string ret = "";
            List <Dictionary <string, string> > result;
            string Spanunit;
            string CPLSout;
            string RATE_VAL;
            string RATE_UNIT;
            string FLOW_SEL;
            string VOL_F_UNIT;
            string MASS_F_UNIT;
            string OUT_MODE;

            RATE_VAL    = Model.DBFieldData.FirstOrDefault(x => x.Key.Equals("E14_P1_RATE_VAL")).Value.AsString();
            RATE_UNIT   = Model.DBFieldData.FirstOrDefault(x => x.Key.Equals("E13_P1_RATE_UNIT")).Value.AsString();
            FLOW_SEL    = Model.DBFieldData.FirstOrDefault(x => x.Key.Equals("C30_PV_FLOW_SEL")).Value.AsString();
            VOL_F_UNIT  = Model.DBFieldData.FirstOrDefault(x => x.Key.Equals("C32_VOL_F_UNIT")).Value.AsString();
            MASS_F_UNIT = Model.DBFieldData.FirstOrDefault(x => x.Key.Equals("C33_MASS_F_UNIT")).Value.AsString();
            OUT_MODE    = Model.DBFieldData.FirstOrDefault(x => x.Key.Equals("E10_P1_OUT_MODE")).Value.AsString();

            rules.ResultColumnsCount = 3;
            CPLSout = "P/SOUT1" + RATE_VAL;

            switch (FLOW_SEL)
            {
            case "1":
                result   = table.getTableResult(Properties.Settings.Default.drvDatabase + "units.txt", VOL_F_UNIT, rules);
                Spanunit = result[0]["VOL_F_UNIT"].ToString();
                break;

            case "2":
                result   = table.getTableResult(Properties.Settings.Default.drvDatabase + "units.txt", MASS_F_UNIT, rules);
                Spanunit = result[0]["MASS_F_UNIT"].ToString();
                break;

            default:
                Spanunit = "";
                break;
            }

            result = table.getTableResult(Properties.Settings.Default.drvDatabase + "units.txt", RATE_UNIT, rules);
            if (result.Count > 0)
            {
                CPLSout += result[0]["RATE_UNIT"].ToString();
            }
            switch (OUT_MODE)
            {
            case "":     // don't print
                CPLSout = "";
                break;

            case "0":     // no function
                break;

            case "1":     // fixed pulse output
                switch (RATE_UNIT)
                {
                case "0":
                case "1":
                case "2":
                case "3":
                case "4":
                case "5":
                    CPLSout += Spanunit + "/P";
                    break;

                case "6":
                case "7":
                case "8":
                case "9":
                case "10":
                case "11":
                    CPLSout += "P/" + Spanunit;
                    break;
                }
                break;

            case "2":     // frequency output
            case "3":     // status output
                break;
            }

            return(CPLSout);
        }
Beispiel #2
0
        public static void fillInfo()
        {
            string[] textos;

            txtTablesLib.sErrorInfo             sErr  = new txtTablesLib.sErrorInfo();
            txtTablesLib.simpleTableTests       table = new txtTablesLib.simpleTableTests(Properties.Settings.Default.drvDatabase + "dlls");
            txtTablesLib.textRules              rules = new txtTablesLib.textRules();
            List <Dictionary <string, string> > result;

            rules.ColumnSeparator    = "\t";
            rules.ORSeparator        = ",";
            rules.ResultColumnsCount = 1;
            rules.RowSeparator       = "\r\n";
            rules.SearchCriteria     = txtTablesLib.textRules.eSearchCriteria.getOnlyFirstOccurrencyLine;
            rules.useWildcards       = true;

            Model.PrintFieldData.Clear();

            addPrintData("MODEL", Model.MSCODE.Substring(0, Model.MSCODE.IndexOf("-")));
            addPrintData("STYLE", Model.DBFieldData.FirstOrDefault(x => x.Key.Equals("SCODE")).Value);
            textos = clFacilities.divideTexto(Model.MSCODE.Substring(Model.MSCODE.IndexOf("-")), clFacilities.eDivideTexto.CODE, true, Properties.Settings.Default.limitIntegralSUFIX1, Properties.Settings.Default.limitIntegralSUFIX2);
            addPrintData("SUFFIX1", textos[0]);
            addPrintData("SUFFIX2", textos.Length > 1 ? textos[1] : "");
            if (!getAccessTable().ToUpper().Equals("AXF_Brain_Hart".ToUpper()))
            {
                addPrintData("SIZE", Model.DBFieldData.FirstOrDefault(x => x.Key.Equals("C27_NOMINAL_SIZE")).Value);
                addPrintData("METERFACTORL", Model.DBFieldData.FirstOrDefault(x => x.Key.Equals("C20_LOWMF")).Value);
                addPrintData("METERFACTORH", Model.DBFieldData.FirstOrDefault(x => x.Key.Equals("C21_HIGHMF")).Value);
            }
            else
            {
                addPrintData("SIZE", Model.DBFieldData.FirstOrDefault(x => x.Key.Equals("NOMISIZE")).Value);
                addPrintData("METERFACTORL", Model.DBFieldData.FirstOrDefault(x => x.Key.Equals("LOWMF")).Value);
                addPrintData("METERFACTORH", Model.DBFieldData.FirstOrDefault(x => x.Key.Equals("HIGHMF")).Value);
            }
            addPrintData("FLUIDPRESS", table.getStringTableResult(Properties.Settings.Default.drvDatabase + "FluidPress.txt", Model.MSCODE, rules));
            addPrintData("FLUIDTEMP", table.getStringTableResult(Properties.Settings.Default.drvDatabase + "FluidTemp.txt", Model.MSCODE, rules));
            addPrintData("AMBTEMP", table.getStringTableResult(Properties.Settings.Default.drvDatabase + "AmbTemp.txt", Model.MSCODE, rules));
            rules.ResultColumnsCount = 2;
            result = table.getTableResult(Properties.Settings.Default.drvDatabase + "PowerSupply.txt", Model.MSCODE, rules);
            addPrintData("SUPPLY1", result.Count > 0 ? result[0]["POWERSUPPLY11"].ToString() : "");
            addPrintData("SUPPLY2", result.Count > 0 ? result[0]["POWERSUPPLY12"].ToString() : "");
            rules.ResultColumnsCount = 1;
            addPrintData("OUTPUT1", table.getStringTableResult(Properties.Settings.Default.drvDatabase + "OutputType.txt", Model.MSCODE, rules));
            addPrintData("OUTPUT2", getOUTPUTRATE(table, rules));
            addPrintData("OUTPUT3", ""); // BLANK
            rules.ResultColumnsCount = 1;
            addPrintData("OUTPUT4", table.getStringTableResult(Properties.Settings.Default.drvDatabase + "Output.txt", Model.MSCODE, rules));
            addPrintData("YEARMONTH", table.getStringTableResult(Properties.Settings.Default.drvDatabase + "ProdYear.txt", Model.MSCODE, rules));
            addPrintData("SERIAL", Model.DBFieldData.FirstOrDefault(x => x.Key.Equals("SERIALNO")).Value);
            addPrintData("SERIAL2", Model.DBFieldData.FirstOrDefault(x => x.Key.Equals("WEEKNO")).Value);
            addPrintData("COMBNO", Model.DBFieldData.FirstOrDefault(x => x.Key.Equals("CSERIAL")).Value);
            textos = clFacilities.divideTexto(Model.DBFieldData.FirstOrDefault(x => x.Key.Equals("TAGNO")).Value, clFacilities.eDivideTexto.SPACES, true, Properties.Settings.Default.limitIntegralTAG1, Properties.Settings.Default.limitIntegralTAG2);
            addPrintData("TAG1", textos[0]);
            //addPrintData("TAG2", textos[1]);
            textos = clFacilities.divideTexto(Model.DBFieldData.FirstOrDefault(x => x.Key.Equals("TAGNO")).Value, clFacilities.eDivideTexto.SPACES, true, Properties.Settings.Default.limitTagTAG1, Properties.Settings.Default.limitTagTAG2);
            addPrintData("TAG_TAG1", textos[0]);
            addPrintData("TAG_TAG2", textos[1]);

            Model.hasIntegral     = Model.MSCODE.Substring(8, 1).Equals("A");
            Model.hasRemoteSensor = "DW".Contains(Model.MSCODE.Substring(8, 1));
            Model.hasTag          = Model.MSCODE.Contains("/SCT");
        }