예제 #1
0
        public static bool uploadCriticalData(List <CriticalData> criticalDataList)
        {
            Program.WriteLog("调用web服务,上传关键数据");
            List <TrainRemoteControl.WebModel.CriticalData> cdList = new List <WebModel.CriticalData>();

            try{
                for (int i = 0; i < criticalDataList.Count; i++)
                {
                    TrainRemoteControl.WebModel.CriticalData cd = new WebModel.CriticalData();
                    cd.alarmValue  = criticalDataList[i].AlarmValue;
                    cd.current     = criticalDataList[i]._Current;
                    cd.dateTime    = criticalDataList[i].Date;
                    cd.frequency   = criticalDataList[i].Frequency;
                    cd.generatorId = criticalDataList[i].GeneratorId;
                    cd.lcNum       = criticalDataList[i].LcNum;
                    cd.motorPower  = criticalDataList[i].MotorPower;
                    cd.motorSpeed  = criticalDataList[i].MotorSpeed;
                    cd.oilMass     = criticalDataList[i].OilMass;
                    cd.oilPress    = criticalDataList[i].OilPress;
                    cd.powerFactor = criticalDataList[i].PowerFactor;
                    cd.trainInfo   = null;
                    cd.voltage     = criticalDataList[i].Voltage;
                    cd.waterTemp   = criticalDataList[i].WaterTemp;
                    cdList.Add(cd);
                }
                string str       = Program.ScriptSerialize(cdList);
                string returnret = Program.g_trainService.SaveCriticalData(str);
                if (!"0".Equals(returnret))
                {
                    Program.WriteLog("调用web服务返回:" + returnret + " ,调用成功");
                    return(true);
                }
                else
                {
                    return(false);
                }
            } catch (Exception error) {
                Program.WriteLog("" + error.ToString());
                return(false);
            }
        }
예제 #2
0
        public string buildUploadCriticalData(CriticalData []  criticalDataList)
        {
            string str = "";

            Program.WriteLog(" 组装需要上传关键数据");
            List <TrainRemoteControl.WebModel.CriticalData> cdList = new List <WebModel.CriticalData>();

            try
            {
                for (int i = 0; i < criticalDataList.Length; i++)
                {
                    TrainRemoteControl.WebModel.CriticalData cd = new WebModel.CriticalData();
                    cd.alarmValue  = criticalDataList[i].AlarmValue;
                    cd.current     = Math.Round(criticalDataList[i]._Current, 2);
                    cd.dateTime    = criticalDataList[i].Date;
                    cd.frequency   = Math.Round(criticalDataList[i].Frequency, 2);
                    cd.generatorId = criticalDataList[i].GeneratorId;
                    cd.lcNum       = criticalDataList[i].LcNum;
                    cd.motorPower  = Math.Round(criticalDataList[i].MotorPower, 2);
                    cd.motorSpeed  = Math.Round(criticalDataList[i].MotorSpeed, 2);
                    cd.oilMass     = Math.Round(criticalDataList[i].OilMass, 2);
                    cd.oilPress    = Math.Round(criticalDataList[i].OilPress, 2);
                    cd.powerFactor = Math.Round(criticalDataList[i].PowerFactor, 2);
                    cd.trainInfo   = null;
                    cd.voltage     = Math.Round(criticalDataList[i].Voltage, 2);
                    cd.waterTemp   = Math.Round(criticalDataList[i].WaterTemp, 2);
                    cdList.Add(cd);
                }
                str = Program.ScriptSerialize(cdList);
                Program.WriteLog("组装后的数据:" + str);
            }
            catch (Exception error)
            {
                Program.WriteLog("" + error.ToString());
            }
            return(str);
        }