/// <summary>
        /// 获取点号
        /// </summary>
        private void getpoint()
        {
            DataTable dt = new DataTable();

            cmb_adr.Properties.Items.Clear();
            PointDefineGetByDevpropertIDRequest pointDefineRequest = new PointDefineGetByDevpropertIDRequest();

            pointDefineRequest.DevpropertID = 1;
            dt = Basic.Framework.Common.ObjectConverter.ToDataTable <Jc_DefInfo>(pointDefineService.GetPointDefineCacheByDevpropertID(pointDefineRequest).Data);
            if (dt != null && dt.Rows.Count > 0)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    cmb_adr.Properties.Items.Add(dt.Rows[i]["point"].ToString());
                }
            }
            if (obj.analogpoint != "")
            {
                for (int i = 0; i < cmb_adr.Properties.Items.Count; i++)
                {
                    if (obj.analogpoint == cmb_adr.Properties.Items[i].ToString())
                    {
                        cmb_adr.SelectedIndex = i;
                        break;
                    }
                }
            }
        }
Example #2
0
        private void RealKZControl_Load(object sender, EventArgs e)
        {
            inigrid();
            try
            {
                getdata();
                var nowtime = Model.RealInterfaceFuction.GetServerNowTime();

                PointDefineGetByDevpropertIDRequest PointDefineRequest = new PointDefineGetByDevpropertIDRequest();
                PointDefineRequest.DevpropertID = 3;
                List <Jc_DefInfo> pointDefineControlList = pointDefineService.GetPointDefineCacheByDevpropertID(PointDefineRequest).Data;

                refresh(nowtime, pointDefineControlList);
            }
            catch (Exception ex)
            {
                Basic.Framework.Logging.LogHelper.Error(ex);
            }
            //timer1.Enabled = true;
            freshthread = new Thread(new ThreadStart(fthread));
            freshthread.Start();
        }
Example #3
0
        /// <summary>
        /// 获取所有分站
        /// </summary>
        /// <returns></returns>
        public static List <Jc_DefInfo> GetAllSubstation()
        {
            var req = new PointDefineGetByDevpropertIDRequest
            {
                DevpropertID = 0
            };
            var res = PointDefineService.GetPointDefineCacheByDevpropertID(req);

            if (!res.IsSuccess)
            {
                throw new Exception(res.Message);
            }
            return(res.Data);
        }
        /// <summary>通过设备性质查找测点
        /// </summary>
        /// <param name="com"></param>
        /// <returns></returns>
        public static List <Jc_DefInfo> QueryPointByDevpropertIDCache(int DevPropertID)
        {
            PointDefineGetByDevpropertIDRequest PointDefineRequest = new PointDefineGetByDevpropertIDRequest();

            PointDefineRequest.DevpropertID = DevPropertID;
            var result = _PointDefineService.GetPointDefineCacheByDevpropertID(PointDefineRequest);

            if (result.IsSuccess == true)
            {
                return(result.Data);
            }
            else
            {
                throw new Exception(result.Message);
            }
        }
Example #5
0
        /// <summary>
        ///     通过设备性质查找测点
        /// </summary>
        /// <param name="com"></param>
        /// <returns></returns>
        public static IList <Jc_DefInfo> QueryPointByDevpropertIDCache(int DevPropertID)
        {
            //IJC_DEFService DEFService = ServiceFactory.CreateService<IJC_DEFService>();
            //return DEFService.QueryPointByDevpropertIDCache(DevPropertID);

            //var pointDefineCacheRequest = new PointDefineCacheGetByConditonRequest
            //{
            //    Predicate =
            //        a => (a.DevPropertyID == DevPropertID) && (a.Activity == "1") && (a.InfoState != InfoState.Delete)
            //};
            //var res = PointDefineService.GetPointDefineCacheByDynamicCondition(pointDefineCacheRequest);
            var req = new PointDefineGetByDevpropertIDRequest
            {
                DevpropertID = DevPropertID
            };
            var res = PointDefineService.GetPointDefineCacheByDevpropertID(req);

            if (!res.IsSuccess)
            {
                throw new Exception(res.Message);
            }
            return(res.Data);
        }
 public BasicResponse <List <Jc_DefInfo> > GetPointDefineCacheByDevpropertID(PointDefineGetByDevpropertIDRequest PointDefineRequest)
 {
     return(_PointDefineService.GetPointDefineCacheByDevpropertID(PointDefineRequest));
 }
        private void SensorCalibration_Load(object sender, EventArgs e)
        {
            try
            {
                DataTable dt = new DataTable();
                dt.Columns.Add("PointId");
                dt.Columns.Add("Point");
                dt.Columns.Add("Position");
                dt.Columns.Add("DevName");
                dt.Columns.Add("UpAarmValue");
                dt.Columns.Add("DownAarmValue");
                dt.Columns.Add("UpDdValue");
                dt.Columns.Add("DownDdValue");
                dt.Columns.Add("UpHfValue");
                dt.Columns.Add("DownHfValue");
                dt.Columns.Add("LC2");
                dt.Columns.Add("SeniorGradeAlarmValue");
                dt.Columns.Add("SeniorGradeTimeValue");
                //object[] obj = new object[13];
                //obj[0] = "1";
                //obj[1] = "001A010";
                //obj[2] = "10101工作面甲烷";
                //obj[3] = "甲烷传感器";
                //obj[4] = "1.0/0.9";
                //obj[5] = "0/0";
                //obj[6] = "1.5/1.4";
                //obj[7] = "0/0";
                //obj[8] = "0.9/0.9";
                //obj[9] = "0/0";
                //obj[10] = "40/40";
                //obj[11] = "0.5/0.8/1.0/1.5";
                //obj[12] = "1/2/3/4";
                //dt.Rows.Add(obj);

                PointDefineGetByDevpropertIDRequest PointDefineRequest = new PointDefineGetByDevpropertIDRequest();
                PointDefineRequest.DevpropertID = 1;
                List <Jc_DefInfo> defList = pointDefineService.GetPointDefineCacheByDevpropertID(PointDefineRequest).Data;
                //defList = defList.FindAll(a => a.Z2 != a.DeviceInfoItem.UpAarmValue || a.Z3 != a.DeviceInfoItem.UpDdValue || a.Z4 != a.DeviceInfoItem.UpHfValue
                //    || a.Z6 != a.DeviceInfoItem.DownAarmValue || a.Z7 != a.DeviceInfoItem.DownDdValue || a.Z8 != a.DeviceInfoItem.DownHfValue);
                List <Jc_DefInfo> allSensorDefineNotMatchList = new List <Jc_DefInfo>();
                foreach (Jc_DefInfo def in defList)
                {
                    if (def.Z2 != def.DeviceInfoItem.UpAarmValue)
                    {
                        allSensorDefineNotMatchList.Add(def);
                    }
                    if (def.Z3 != def.DeviceInfoItem.UpDdValue)
                    {
                        allSensorDefineNotMatchList.Add(def);
                    }
                    if (def.Z4 != def.DeviceInfoItem.UpHfValue)
                    {
                        allSensorDefineNotMatchList.Add(def);
                    }
                    if (def.Z6 != def.DeviceInfoItem.DownAarmValue)
                    {
                        allSensorDefineNotMatchList.Add(def);
                    }
                    if (def.Z7 != def.DeviceInfoItem.DownDdValue)
                    {
                        allSensorDefineNotMatchList.Add(def);
                    }
                    if (def.Z8 != def.DeviceInfoItem.DownHfValue)
                    {
                        allSensorDefineNotMatchList.Add(def);
                    }
                    string[] GradingAlarmLevel = def.Bz8.Split(',');
                    if (GradingAlarmLevel.Length < 4)
                    {
                        GradingAlarmLevel = new string[4] {
                            "0", "0", "0", "0"
                        };
                    }
                    if (float.Parse(GradingAlarmLevel[0]) != def.DeviceInfoItem.SeniorGradeAlarmValue1)
                    {
                        allSensorDefineNotMatchList.Add(def);
                    }
                    if (float.Parse(GradingAlarmLevel[1]) != def.DeviceInfoItem.SeniorGradeAlarmValue2)
                    {
                        allSensorDefineNotMatchList.Add(def);
                    }
                    if (float.Parse(GradingAlarmLevel[2]) != def.DeviceInfoItem.SeniorGradeAlarmValue3)
                    {
                        allSensorDefineNotMatchList.Add(def);
                    }
                    if (float.Parse(GradingAlarmLevel[3]) != def.DeviceInfoItem.SeniorGradeAlarmValue4)
                    {
                        allSensorDefineNotMatchList.Add(def);
                    }
                    string[] GradingAlarmTime = def.Bz9.Split(',');
                    if (GradingAlarmTime.Length < 4)
                    {
                        GradingAlarmTime = new string[4] {
                            "0", "0", "0", "0"
                        };
                    }
                    if (float.Parse(GradingAlarmTime[0]) != def.DeviceInfoItem.SeniorGradeTimeValue1)
                    {
                        allSensorDefineNotMatchList.Add(def);
                    }
                    if (float.Parse(GradingAlarmTime[1]) != def.DeviceInfoItem.SeniorGradeTimeValue2)
                    {
                        allSensorDefineNotMatchList.Add(def);
                    }
                    if (float.Parse(GradingAlarmTime[2]) != def.DeviceInfoItem.SeniorGradeTimeValue3)
                    {
                        allSensorDefineNotMatchList.Add(def);
                    }
                    if (float.Parse(GradingAlarmTime[3]) != def.DeviceInfoItem.SeniorGradeTimeValue4)
                    {
                        allSensorDefineNotMatchList.Add(def);
                    }
                }
                foreach (Jc_DefInfo def in allSensorDefineNotMatchList)
                {
                    object[] obj = new object[13];
                    obj[0]  = def.PointID;
                    obj[1]  = def.Point;
                    obj[2]  = def.Wz;
                    obj[3]  = def.DevName;
                    obj[4]  = def.Z2 + "/" + def.DeviceInfoItem.UpAarmValue;
                    obj[5]  = def.Z6 + "/" + def.DeviceInfoItem.DownAarmValue;
                    obj[6]  = def.Z3 + "/" + def.DeviceInfoItem.UpDdValue;
                    obj[7]  = def.Z7 + "/" + def.DeviceInfoItem.DownDdValue;
                    obj[8]  = def.Z4 + "/" + def.DeviceInfoItem.UpHfValue;
                    obj[9]  = def.Z8 + "/" + def.DeviceInfoItem.DownHfValue;
                    obj[10] = "";
                    obj[11] = def.Bz8 + "/" + def.DeviceInfoItem.SeniorGradeAlarmValue1 + "," + def.DeviceInfoItem.SeniorGradeAlarmValue2
                              + "," + def.DeviceInfoItem.SeniorGradeAlarmValue3 + "," + def.DeviceInfoItem.SeniorGradeAlarmValue4;
                    obj[12] = def.Bz9 + "/" + def.DeviceInfoItem.SeniorGradeTimeValue1 + "," + def.DeviceInfoItem.SeniorGradeTimeValue2
                              + "," + def.DeviceInfoItem.SeniorGradeTimeValue3 + "," + def.DeviceInfoItem.SeniorGradeTimeValue4;
                    dt.Rows.Add(obj);
                }

                gridControl1.DataSource = dt;
            }
            catch (Exception ex)
            {
                Basic.Framework.Logging.LogHelper.Error(ex);
            }
        }
        public void PowerboxchargeStaticThread()
        {
            DateTime timeNow = DateTime.Now;
            List <PowerboxchargehistoryInfo> PowerboxchargehistoryList = new List <PowerboxchargehistoryInfo>();
            List <Jc_DefInfo> StationList = new List <Jc_DefInfo>();

            while (true)
            {
                try
                {
                    timeNow = DateTime.Now;
                    PowerboxchargehistoryGetByStimeRequest powerboxchargehistoryRequest = new PowerboxchargehistoryGetByStimeRequest();
                    powerboxchargehistoryRequest.Stime = timeNow.AddDays(-1);
                    PowerboxchargehistoryList          = powerboxchargehistoryService.GetPowerboxchargehistoryByStime(powerboxchargehistoryRequest).Data;
                    StationList = pointDefineService.GetPointDefineCacheByDevpropertID(new Request.PointDefine.PointDefineGetByDevpropertIDRequest()
                    {
                        DevpropertID = 0
                    }).Data;
                    List <Jc_MacInfo> macList = networkModuleService.GetAllNetworkModuleCache().Data;
                    foreach (PowerboxchargehistoryInfo powerboxcharge in PowerboxchargehistoryList)
                    {
                        if (powerboxcharge.DischargeStime < DateTime.Parse("2000-01-01"))//放电开始判断
                        {
                            if (string.IsNullOrEmpty(powerboxcharge.Mac))
                            {//分站电源箱
                                Jc_DefInfo station = StationList.Find(a => a.Fzh == short.Parse(powerboxcharge.Fzh));
                                if (station != null)
                                {
                                    TimeSpan ts = station.DttRunStateTime - powerboxcharge.Stime;
                                    if (station.State == 4 && ts.TotalMinutes < 5)//如果操作放电,分站在5分钟内变成直流了,则记录放电的开始时间
                                    {
                                        powerboxcharge.DischargeStime = station.DttRunStateTime;
                                        PowerboxchargehistoryUpdate(powerboxcharge);
                                    }
                                }
                            }
                            else
                            {
                                GetMacPowerboxInfo(powerboxcharge.Mac);
                                //交换机电源箱
                                Jc_MacInfo mac = macList.Find(a => a.MAC == powerboxcharge.Mac);
                                if (mac != null)
                                {
                                    if (mac.BatteryItems != null && mac.BatteryItems.Count > 0)
                                    {
                                        if (mac.BatteryItems[0].BatteryACDC == 2)//如果操作放电,交换机变成直流,则记录放电的开始时间
                                        {
                                            powerboxcharge.DischargeStime = mac.PowerDateTime;
                                            PowerboxchargehistoryUpdate(powerboxcharge);
                                        }
                                    }
                                }
                            }
                        }
                        else if (powerboxcharge.DischargeEtime < DateTime.Parse("2000-01-01"))//放电结束判断
                        {
                            if (string.IsNullOrEmpty(powerboxcharge.Mac))
                            {
                                Jc_DefInfo station = StationList.Find(a => a.Fzh == short.Parse(powerboxcharge.Fzh));
                                if (station != null && station.State == 3)//如果分站变成交流了,则记录放电的结束时间
                                {
                                    powerboxcharge.DischargeEtime = station.DttRunStateTime;
                                    PowerboxchargehistoryUpdate(powerboxcharge);
                                }
                            }
                            else
                            {
                                GetMacPowerboxInfo(powerboxcharge.Mac);
                                //交换机电源箱
                                Jc_MacInfo mac = macList.Find(a => a.MAC == powerboxcharge.Mac);
                                if (mac != null)
                                {
                                    if (mac.BatteryItems != null && mac.BatteryItems.Count > 0)
                                    {
                                        if (mac.BatteryItems[0].BatteryACDC == 1)//如果交换机变成交流了,则记录放电的结束时间
                                        {
                                            powerboxcharge.DischargeEtime = mac.PowerDateTime;
                                            PowerboxchargehistoryUpdate(powerboxcharge);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    Basic.Framework.Logging.LogHelper.Error(ex);
                }
                Thread.Sleep(60000);
            }
        }