Ejemplo n.º 1
0
 public bool SaveTransformerDataBase(Translator testmessage)
 {
     try
     {
         Model.Transformer trs = new Model.Transformer
         {
             TestId        = testmessage.TestId,
             RatedVoltage  = testmessage.RatedVoltage,
             RatedCapacity = testmessage.RatedCapacity,
             WindingGroup  = testmessage.WindingGroup,
             Temperature   = testmessage.Temperature,
             Humidity      = testmessage.Humidity,
             TestLocation  = testmessage.TestLocation,
             Tester        = testmessage.Tester,
             Frequency     = testmessage.Frequency,
             Volate        = testmessage.Volate,
             currentnum    = testmessage.Current,
             DateTime      = testmessage.DateTime,
             TestKind      = "配电变压器试验",
             DatagridData  = _jsondeel.GetJsonByclass(testmessage.DatagridData),
             TestResult    = _jsondeel.GetJsonByclass(testmessage.TestResultData)
         };
         entityServer.EfModel.Transformers.Add(trs);
         entityServer.EfModel.SaveChanges();
         return(true);
     }
     catch
     {
         _logger.Writer("WithstandVoltageViewModel,保存任务单EF错误");
     }
     return(false);
 }
Ejemplo n.º 2
0
        public StataTwo ParsingTwo(byte[] data)
        {
            StataTwo stataTwo = new StataTwo();

            try
            {
                stataTwo.AVolate  = System.Convert.ToDouble(Encoding.Default.GetString(data.Skip(2).Take(4).ToArray()));
                stataTwo.ACurrent = System.Convert.ToDouble(Encoding.Default.GetString(data.Skip(7).Take(4).ToArray()));
                stataTwo.BVolate  = System.Convert.ToDouble(Encoding.Default.GetString(data.Skip(12).Take(4).ToArray()));
                stataTwo.BCurrent = System.Convert.ToDouble(Encoding.Default.GetString(data.Skip(17).Take(4).ToArray()));
                stataTwo.CVolate  = System.Convert.ToDouble(Encoding.Default.GetString(data.Skip(22).Take(4).ToArray()));
                stataTwo.CCurrent = System.Convert.ToDouble(Encoding.Default.GetString(data.Skip(27).Take(4).ToArray()));
                stataTwo.stata    = Getstata(data[32]);
            }
            catch
            {
                stataTwo.stata = Methonstata.False;
                _logger.Writer("Parsingdata: " + new System.Diagnostics.StackTrace(1, true).GetFrame(0).GetFileLineNumber().ToString() + " 行" + "。 解析ParsingTwo出错");
            }
            return(stataTwo);
        }
Ejemplo n.º 3
0
 public void Handle(string CGF)
 {
     if (CGF != null)
     {
         try
         {
             UVolateUi = Convert.ToDouble(CGF);
         }
         catch
         {
             _logger.Writer("Cgf电压解析出错");
         }
     }
 }
Ejemplo n.º 4
0
        public StataTwo ReadStataTwo()
        {
            var rec = new byte[34];
            int num = 0;

            for (int i = 0; i < 10; i++)
            {
                if (num == 34)
                {
                    if (rec[0] == 0xda && rec[1] == 0xda)
                    {
                        return(_parsingdata.ParsingTwo(rec));
                    }
                    else
                    {
                        _logger.Writer("CommunicationProtocol: " + new System.Diagnostics.StackTrace(1, true).GetFrame(0).GetFileLineNumber().ToString() + " 行" + "。 解析ReadStataTwo数据头出错");
                    }
                }
                else
                {
                    num = Comport.Serial.serialport.SendCommand(new byte[2] {
                        0x02, 0xda
                    }, ref rec, 10);
                    _logger.Writer(rec);
                }
            }
            return(new StataTwo {
                stata = Methonstata.False
            });
        }