private static void DoDCInsulation(DataRow TestResultRow)
        {
            DataRow row       = WorkingSets.local.Insulationresistance_Threewinding.NewRow();
            DataRow rowResult = WorkingSets.local.Insulationresistance_Threewindingresults.NewRow();

            if ((string)TestResultRow["windingtype"] == "0")
            {
                row["High_CentreLowPressure"] = TestResultRow["result_pv2"];
            }
            if ((string)TestResultRow["windingtype"] == "1")
            {
                row["Centre_HighLowPressure"] = TestResultRow["result_pv2"];
            }
            if ((string)TestResultRow["windingtype"] == "2")
            {
                row["Low_HighMediumVoltage"] = TestResultRow["result_pv2"];
            }
            var ji = JobInformation.FromString((string)TestResultRow["waves"]);

            rowResult["TestCode"]       = ji.GetHashCode();
            rowResult["Temperature"]    = ji.temperature;
            rowResult["Humidity"]       = ji.humidity;
            rowResult["OilTemperature"] = ji.oilTemperature;
            WorkingSets.local.Insulationresistance_Threewinding.Rows.Add(row);
            WorkingSets.local.Insulationresistance_Threewindingresults.Rows.Add(row);
            WorkingSets.local.SaveCreateLocateDatabase();
        }
        private static void DoCapacitance(DataRow TestResultRow)
        {
            DataRow rowResult      = WorkingSets.local.Dielectriclossandcapacitance_Threewindingresults.NewRow();
            DataRow CapacitanceRow = WorkingSets.local.Dielectriclossandcapacitance_Threewinding.NewRow();
            DataRow CnRow          = WorkingSets.local.Dielectriclossandcapacitance_Threewinding.NewRow();

            if ((int)TestResultRow["windingtype"] == 0)
            {
                CapacitanceRow["HighPressure_CentreLowPressure"] = TestResultRow["result_pv4"]; //兆欧表套管
                CnRow["HighPressure_CentreLowPressure"]          = TestResultRow["result_pv3"]; //兆欧表套管
            }
            if ((int)TestResultRow["windingtype"] == 1)
            {
                CapacitanceRow["MediumVoltage_HighLowPressure"] = TestResultRow["result_pv4"]; //兆欧表套管
                CnRow["MediumVoltage_HighLowPressure"]          = TestResultRow["result_pv3"]; //兆欧表套管
            }
            if ((int)TestResultRow["windingtype"] == 2)
            {
                CapacitanceRow["LowPressure_HighMediumVoltage"] = TestResultRow["result_pv4"]; //兆欧表套管
                CnRow["LowPressure_HighMediumVoltage"]          = TestResultRow["result_pv3"]; //兆欧表套管
            }
            if (TestResultRow["waves"] != null)
            {
                var ji = JobInformation.FromString((string)TestResultRow["waves"]);
                rowResult["TestCode"]       = ji.GetHashCode();
                rowResult["Temperature"]    = ji.temperature;
                rowResult["Humidity"]       = ji.humidity;
                rowResult["OilTemperature"] = ji.oilTemperature;
            }
            WorkingSets.local.Dielectriclossandcapacitance_Threewinding.Rows.Add(CapacitanceRow);
            WorkingSets.local.Dielectriclossandcapacitance_Threewinding.Rows.Add(CnRow);
            WorkingSets.local.Dielectriclossandcapacitance_Threewindingresults.Rows.Add(CnRow);
            WorkingSets.local.SaveCreateLocateDatabase();
        }
        private static void DoBushingDCInsulation(DataRow TestResultRow)
        {
            DataRow row       = WorkingSets.local.Casingtest_Commonbody.NewRow();
            DataRow rowResult = WorkingSets.local.Casingtest_Commonbodyresults.NewRow();

            if ((int)TestResultRow["windingtype"] == 0)
            {
                if ((string)TestResultRow["terimal"] == "0")
                {
                    row["O"] = TestResultRow["result_pv2"];//兆欧表套管
                }
                if ((string)TestResultRow["terimal"] == "A")
                {
                    row["A"] = TestResultRow["result_pv2"];//兆欧表套管
                }
                if ((string)TestResultRow["terimal"] == "B")
                {
                    row["B"] = TestResultRow["result_pv2"];//兆欧表套管
                }
                if ((string)TestResultRow["terimal"] == "C")
                {
                    row["C"] = TestResultRow["result_pv2"];//兆欧表套管
                }
            }
            if ((int)TestResultRow["windingtype"] == 1)
            {
                if ((string)TestResultRow["terimal"] == "0")
                {
                    row["Om"] = TestResultRow["result_pv2"];//兆欧表套管
                }
                if ((string)TestResultRow["terimal"] == "A")
                {
                    row["Am"] = TestResultRow["result_pv2"];//兆欧表套管
                }
                if ((string)TestResultRow["terimal"] == "B")
                {
                    row["Bm"] = TestResultRow["result_pv2"];//兆欧表套管
                }
                if ((string)TestResultRow["terimal"] == "C")
                {
                    row["Cm"] = TestResultRow["result_pv2"];//兆欧表套管
                }
            }
            var ji = JobInformation.FromString((string)TestResultRow["waves"]);

            rowResult["TestCode"]       = ji.GetHashCode();
            rowResult["Temperature"]    = ji.temperature;
            rowResult["Humidity"]       = ji.humidity;
            rowResult["OilTemperature"] = ji.oilTemperature;
            WorkingSets.local.Casingtest_Commonbody.Rows.Add(row);
            WorkingSets.local.Casingtest_Commonbodyresults.Rows.Add(row);
            WorkingSets.local.SaveCreateLocateDatabase();
        }
        private static void DoDcResistance(DataRow TestResultRow)
        {
            DataRow rowHigh = WorkingSets.local.Dcresistor_Highpressure.NewRow();
            DataRow rowM    = WorkingSets.local.Dcresistor_Mediumvoltage.NewRow();
            DataRow rowLow  = WorkingSets.local.Dcresistor_Lowpressure.NewRow();

            if ((string)TestResultRow["terimal"] == "1;2")
            {
                rowHigh["A0"] = TestResultRow["result_pv3"];
                rowHigh["B0"] = TestResultRow["result_pv6"];
                rowHigh["C0"] = TestResultRow["result_pv9"];
            }
            if ((string)TestResultRow["terimal"] == "2;3")
            {
                rowM["A0"] = TestResultRow["result_pv3"];
                rowM["B0"] = TestResultRow["result_pv6"];
                rowM["C0"] = TestResultRow["result_pv9"];
            }
            if ((string)TestResultRow["terimal"] == "3;1")
            {
                rowLow["A0"] = TestResultRow["result_pv3"];
                rowLow["B0"] = TestResultRow["result_pv6"];
                rowLow["C0"] = TestResultRow["result_pv9"];
            }
            if ((string)TestResultRow["terimal"] == null)
            {
                rowHigh["A0"] = TestResultRow["result_pv3"];
                rowHigh["B0"] = TestResultRow["result_pv6"];
                rowHigh["C0"] = TestResultRow["result_pv9"];
                rowM["A0"]    = TestResultRow["result_pv3"];
                rowM["B0"]    = TestResultRow["result_pv6"];
                rowM["C0"]    = TestResultRow["result_pv9"];
                rowLow["A0"]  = TestResultRow["result_pv3"];
                rowLow["B0"]  = TestResultRow["result_pv6"];
                rowLow["C0"]  = TestResultRow["result_pv9"];
            }
            DataRow rowResult = WorkingSets.local.Casingtest_Commonbodyresults.NewRow();
            var     ji        = JobInformation.FromString((string)TestResultRow["waves"]);

            rowResult["TestCode"]       = ji.GetHashCode();
            rowResult["Temperature"]    = ji.temperature;
            rowResult["Humidity"]       = ji.humidity;
            rowResult["OilTemperature"] = ji.oilTemperature;
            WorkingSets.local.Dcresistor_Highpressureresults.Rows.Add(rowResult);
            WorkingSets.local.Dcresistor_Lowpressureresults.Rows.Add(rowResult);
            WorkingSets.local.Dcresistor_Mediumvoltageresults.Rows.Add(rowResult);
            WorkingSets.local.Dcresistor_Highpressure.Rows.Add(rowHigh);
            WorkingSets.local.Dcresistor_Mediumvoltage.Rows.Add(rowM);
            WorkingSets.local.Dcresistor_Lowpressure.Rows.Add(rowLow);
            WorkingSets.local.SaveCreateLocateDatabase();
        }
        public List <string> getTestResultsFromJobID(int JobID)
        {
            List <string> ls        = new List <string>();
            string        selectStr = "mj_id = " + JobID.ToString();
            var           rows      = TestResults.Select(selectStr);

            foreach (var r in rows)
            {
                if ((int)r["function"] == (int)MeasurementFunction.Information)
                {
                    var ji = JobInformation.FromString((string)r["waves"]);
                    ls.Add(ji.testingName + "(" + ji.testingTime.ToString("yyyy-MM-dd") + ")");
                }
            }
            return(ls);
        }
        public TestingWorkerSender getTestResults(string s)
        {
            var  rows   = TestResults.Select("function = " + ((int)MeasurementFunction.Information).ToString());
            int  testid = 0;
            bool valid  = false;

            foreach (var r in rows)
            {
                var ji = JobInformation.FromString((string)r["waves"]);
                if ((ji.testingName + "(" + ji.testingTime.ToString("yyyy-MM-dd") + ")") == s)
                {
                    testid = (int)r["testid"];
                    valid  = true;
                }
            }
            if (!valid)
            {
                throw new Exception("测试结果查找为空");
            }
            rows = TestResults.Select("testid = " + testid.ToString());
            if (rows.Length <= 0)
            {
                throw new Exception("测试结果导出出错");
            }
            var tws = new TestingWorkerSender();

            tws.job              = getJob((int)rows[0]["mj_id"]);
            tws.Transformer      = getTransformer((int)rows[0]["transformerid"]);
            tws.ProgressPercent  = 100;
            tws.CurrentItemIndex = 0;
            List <MeasurementItemStruct> mis = new List <MeasurementItemStruct>();

            foreach (var r in rows)
            {
                if ((int)r["function"] != (int)MeasurementFunction.Information)
                {
                    mis.Add(MeasurementItemStruct.FromDataRow(r));
                }
                else
                {
                    tws.job.Information = JobInformation.FromString((string)r["waves"]);
                }
            }
            tws.MeasurementItems = mis.ToArray();
            return(tws);
        }
        private static void DoOLTESwich(DataRow TestResultRow)
        {
            DataRow rowResult = WorkingSets.local.Tapchangertestresults.NewRow();
            DataRow OLTERow   = WorkingSets.local.Tapchangertest.NewRow();

            OLTERow["SwitchingTime"] = TestResultRow["recordtime"];
            OLTERow["testchart"]     = TestResultRow["waves"];
            var ji = JobInformation.FromString((string)TestResultRow["waves"]);

            if (ji.temperature != "100")
            {
                rowResult["TestCode"]       = ji.GetHashCode();
                rowResult["Temperature"]    = ji.temperature;
                rowResult["Humidity"]       = ji.humidity;
                rowResult["OilTemperature"] = ji.oilTemperature;
            }
            WorkingSets.local.Tapchangertest.Rows.Add(OLTERow);
            WorkingSets.local.Tapchangertestresults.Rows.Add(rowResult);
            WorkingSets.local.SaveCreateLocateDatabase();
        }
Beispiel #8
0
        public static JobInformation FromString(string s)
        {
            JobInformation info = new JobInformation();
            var            sr   = new System.IO.StringReader(s);
            string         base64;

            base64 = sr.ReadLine();
            if (base64 == string.Empty)
            {
                throw new ArgumentException("JobInformation字段信息缺失");
            }
            info.testingTime = DateTime.FromBinary(BitConverter.ToInt64(Convert.FromBase64String(base64), 0));

            base64 = sr.ReadLine();
            if (base64 == string.Empty)
            {
                throw new ArgumentException("JobInformation字段信息缺失");
            }
            info.testingName = Encoding.UTF32.GetString(Convert.FromBase64String(base64));

            base64 = sr.ReadLine();
            if (base64 == string.Empty)
            {
                throw new ArgumentException("JobInformation字段信息缺失");
            }
            info.tester = Encoding.UTF32.GetString(Convert.FromBase64String(base64));

            base64 = sr.ReadLine();
            if (base64 == string.Empty)
            {
                throw new ArgumentException("JobInformation字段信息缺失");
            }
            info.testingAgency = Encoding.UTF32.GetString(Convert.FromBase64String(base64));

            base64 = sr.ReadLine();
            if (base64 == string.Empty)
            {
                throw new ArgumentException("JobInformation字段信息缺失");
            }
            info.auditor = Encoding.UTF32.GetString(Convert.FromBase64String(base64));

            base64 = sr.ReadLine();
            if (base64 == string.Empty)
            {
                throw new ArgumentException("JobInformation字段信息缺失");
            }
            info.approver = Encoding.UTF32.GetString(Convert.FromBase64String(base64));

            base64 = sr.ReadLine();
            if (base64 == string.Empty)
            {
                throw new ArgumentException("JobInformation字段信息缺失");
            }
            info.weather = Encoding.UTF32.GetString(Convert.FromBase64String(base64));

            base64 = sr.ReadLine();
            if (base64 == string.Empty)
            {
                throw new ArgumentException("JobInformation字段信息缺失");
            }
            info.temperature = Encoding.UTF32.GetString(Convert.FromBase64String(base64));

            base64 = sr.ReadLine();
            if (base64 == string.Empty)
            {
                throw new ArgumentException("JobInformation字段信息缺失");
            }
            info.humidity = Encoding.UTF32.GetString(Convert.FromBase64String(base64));

            base64 = sr.ReadLine();
            if (base64 == string.Empty)
            {
                throw new ArgumentException("JobInformation字段信息缺失");
            }
            info.principal = Encoding.UTF32.GetString(Convert.FromBase64String(base64));

            base64 = sr.ReadLine();
            if (base64 == string.Empty)
            {
                throw new ArgumentException("JobInformation字段信息缺失");
            }
            info.oilTemperature = BitConverter.ToDouble(Convert.FromBase64String(base64), 0);

            return(info);
        }