コード例 #1
0
        /// <summary>
        /// 根据图形名称获取图形DTO对象
        /// </summary>
        /// <param name="GraphName"></param>
        /// <returns></returns>
        private GraphicsbaseinfInfo getGraphicDto(string GraphName)
        {
            GraphicsbaseinfInfo Rvalue = new GraphicsbaseinfInfo();

            try
            {
                var getGraphicsbaseinfByNameRequest = new GetGraphicsbaseinfByNameRequest()
                {
                    GraphName = GraphName
                };
                var getGraphicsbaseinfByNameResponse = graphicsbaseinfService.GetGraphicsbaseinfByName(getGraphicsbaseinfByNameRequest);
                Rvalue = getGraphicsbaseinfByNameResponse.Data;
            }
            catch (Exception ex)
            {
                LogHelper.Error("RefPointSsz-getGraphicDto" + ex.Message + ex.StackTrace);
            }
            return(Rvalue);
        }
コード例 #2
0
 private void checkEdit2_Click(object sender, EventArgs e)
 {
     if (this.Text == "新建图形")
     {
         string message = "";
         GraphicsbaseinfInfo graphicsInfo = null;
         //判断是否选择了图形类型
         if (comboBoxType.SelectedItem == null)
         {
             DevExpress.XtraEditors.XtraMessageBox.Show("请选择对应的图形类型", "提示");
             return;
         }
         if (comboBoxType.SelectedItem.ToString() == "动态图")
         {
             message      = "已存在通风系统默认图形,确定要把当前图形设置为通风系统默认图形吗?";
             graphicsInfo = GraphOpt.GetSystemtDefaultGraphics(0);
         }
         else if (comboBoxType.SelectedItem.ToString() == "拓扑图")
         {
             message      = "已存在拓扑定义默认图形,确定要把当前图形设置为拓扑定义默认图形吗?";
             graphicsInfo = GraphOpt.GetSystemtDefaultGraphics(1);
         }
         if (graphicsInfo != null && !string.IsNullOrWhiteSpace(graphicsInfo.GraphId))
         {
             if (this.checkEdit2.Checked == true)
             {
                 return;
             }
             if (DevExpress.XtraEditors.XtraMessageBox.Show(message, "提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
             {
                 this.SysetemDefaultGraphicsId   = graphicsInfo.GraphId;
                 this.EmergencyLinkageGraphicsId = graphicsInfo.GraphId;
                 this.checkEdit2.Checked         = true;
             }
             else
             {
                 this.checkEdit1.Checked = true;
             }
         }
     }
 }
コード例 #3
0
        /// <summary>
        /// 返回图形测点列表
        /// </summary>
        /// <returns></returns>
        private DataTable getAllPointInMap()
        {
            GraphicsbaseinfInfo GraphicsbaseinfDTO_ = new GraphicsbaseinfInfo();
            DataTable           pointsdt            = new DataTable();

            try
            {
                GraphicsbaseinfDTO_ = getGraphicDto(Program.main.GraphOpt.GraphNameNow);
                //先删除图形原有的绑定测点信息

                var getAllPointInMapRequest = new GetAllPointInMapRequest()
                {
                    GraphId = GraphicsbaseinfDTO_.GraphId
                };
                var getAllPointInMapResponse = graphicsbaseinfService.GetAllPointInMap(getAllPointInMapRequest);
                pointsdt = getAllPointInMapResponse.Data;
            }
            catch (Exception ex)
            {
                LogHelper.Error("RefPointSsz-getAllPointInMap" + ex.Message + ex.StackTrace);
            }
            return(pointsdt);
        }
コード例 #4
0
        /// <summary>
        /// 加载测点定义拓展属性
        /// </summary>
        /// <param name="pointDefines"></param>
        private void LoadPointDefineExtendProperty(List <Jc_DefInfo> pointDefines)
        {
            //位置信息
            var positionList = PositionCache.PositionCahceInstance.Query();
            //设备种类信息
            var deviceClassList = DeviceClassCache.DeviceClassCahceInstance.Query();
            //设备性质信息
            var devicePropertyList = DevicePropertyCache.DeviceDefineCahceInstance.Query();
            //设备型号信息
            var deviceTypeList = DeviceTypeCache.DeviceTypeCahceInstance.Query();
            //设备定义信息
            var deviceDefineList = DeviceDefineCache.DeviceDefineCahceInstance.Query();

            //区域信息
            List <AreaInfo>    areaList    = new List <AreaInfo>();
            AreaGetListRequest areaRequest = new AreaGetListRequest();
            var areaResponse = areaServie.GetAreaList(areaRequest);

            if (areaResponse != null && areaResponse.IsSuccess)
            {
                areaList = areaResponse.Data;
            }
            //图形信息,只加载通风系统默认图形对应的测点位置信息  20170829
            var request = new GraphicsbaseinfGetListRequest();

            request.PagerInfo.PageIndex = 1;
            request.PagerInfo.PageSize  = int.MaxValue;
            IGraphicsbaseinfService graphicsbaseinfService = ServiceFactory.Create <IGraphicsbaseinfService>();
            var response = graphicsbaseinfService.GetGraphicsbaseinfList(request);
            GraphicsbaseinfInfo defaultGraphicsbaseinf = response.Data.Find(a => a.Bz3 == "1");

            List <GraphicspointsinfInfo> graphicspointsinfList = new List <GraphicspointsinfInfo>();
            //GraphicspointsinfGetListRequest graphicspointsinfRequest = new GraphicspointsinfGetListRequest();
            var graphicsbaseinfResponse = graphicspointsinfService.GetAllGraphicspointsinfInfo();

            if (graphicsbaseinfResponse != null && graphicsbaseinfResponse.IsSuccess && defaultGraphicsbaseinf != null)
            {
                graphicspointsinfList = graphicsbaseinfResponse.Data.FindAll(g => g.GraphId == defaultGraphicsbaseinf.GraphId);
            }


            pointDefines.ForEach(pointDefine =>
            {
                if (positionList.Any())
                {
                    var area             = areaList.FirstOrDefault(a => a.Areaid == pointDefine.Areaid);
                    pointDefine.AreaName = area == null ? string.Empty : area.Areaname;
                    pointDefine.AreaLoc  = area == null ? string.Empty : area.Loc;
                }
                if (positionList.Any())
                {
                    var position   = positionList.FirstOrDefault(p => p.WzID == pointDefine.Wzid);
                    pointDefine.Wz = position == null ? string.Empty : position.Wz;
                }
                if (graphicspointsinfList.Any())
                {
                    //从通风系统默认图形中获取测点的默认坐标信息  20170829
                    var graphicspoint       = graphicspointsinfList.FirstOrDefault(g => g.Point.Contains(pointDefine.Point));
                    pointDefine.XCoordinate = graphicspoint == null ? string.Empty : graphicspoint.XCoordinate;
                    pointDefine.YCoordinate = graphicspoint == null ? string.Empty : graphicspoint.YCoordinate;
                }
                if (deviceDefineList.Any())
                {
                    var deviceDefine          = deviceDefineList.FirstOrDefault(g => g.Devid == pointDefine.Devid);
                    pointDefine.DevName       = deviceDefine == null ? string.Empty : deviceDefine.Name;
                    pointDefine.DevPropertyID = deviceDefine == null ? 0 : deviceDefine.Type;
                    pointDefine.DevClassID    = deviceDefine == null ? 0 : deviceDefine.Bz3;
                    pointDefine.DevModelID    = deviceDefine == null ? 0 : deviceDefine.Bz4;
                    pointDefine.Unit          = deviceDefine == null ? string.Empty : deviceDefine.Xs1;
                    //pointDefine.Sysid = deviceDefine != null ? 0 : deviceDefine.Sysid; //去掉  20171207
                }
                if (deviceClassList.Any())
                {
                    var deviceClass      = deviceClassList.FirstOrDefault(devc => devc.LngEnumValue == pointDefine.DevClassID);
                    pointDefine.DevClass = deviceClass == null ? string.Empty : deviceClass.StrEnumDisplay;
                }
                if (devicePropertyList.Any())
                {
                    var deviceProperty      = devicePropertyList.FirstOrDefault(devc => devc.LngEnumValue == pointDefine.DevPropertyID);
                    pointDefine.DevProperty = deviceProperty == null ? string.Empty : deviceProperty.StrEnumDisplay;
                }
                if (deviceTypeList.Any())
                {
                    var deviceType       = deviceTypeList.FirstOrDefault(devc => devc.LngEnumValue == pointDefine.DevModelID);
                    pointDefine.DevModel = deviceType == null ? string.Empty : deviceType.StrEnumDisplay;
                }


                //赋值初始状态
                pointDefine.DataState = 46;
                pointDefine.State     = 46;

                pointDefine.ClsCommObj   = new DataContract.CommunicateExtend.CommProperty((uint)pointDefine.Fzh);
                pointDefine.DttStateTime = DateTime.Now;  //2017.11.30 by

                if (pointDefine.DevPropertyID == 0)
                {
                    pointDefine.ClsCommObj.BInit = false;
                    pointDefine.sendIniCount     = 1;
                }
            });
        }
コード例 #5
0
        /// <summary>
        /// 加载测点定义拓展属性
        /// </summary>
        /// <param name="pointDefines"></param>
        private void LoadPointDefineExtendProperty(List <Jc_DefInfo> pointDefines)
        {
            //位置信息
            var positionList = PositionCache.PositionCahceInstance.Query();
            //设备种类信息
            var deviceClassList = DeviceClassCache.DeviceClassCahceInstance.Query();
            //设备性质信息
            var devicePropertyList = DevicePropertyCache.DeviceDefineCahceInstance.Query();
            //设备型号信息
            var deviceTypeList = DeviceTypeCache.DeviceTypeCahceInstance.Query();
            //设备定义信息
            var deviceDefineList = DeviceDefineCache.DeviceDefineCahceInstance.Query();
            //区域信息
            List <AreaInfo>    areaList    = new List <AreaInfo>();
            AreaGetListRequest areaRequest = new AreaGetListRequest();
            var areaResponse = areaServie.GetAreaList(areaRequest);

            if (areaResponse != null && areaResponse.IsSuccess)
            {
                areaList = areaResponse.Data;
            }
            //图形信息,只加载通风系统默认图形对应的测点位置信息  20170829
            var request = new GraphicsbaseinfGetListRequest();

            request.PagerInfo.PageIndex = 1;
            request.PagerInfo.PageSize  = int.MaxValue;
            IGraphicsbaseinfService graphicsbaseinfService = ServiceFactory.Create <IGraphicsbaseinfService>();
            var response = graphicsbaseinfService.GetGraphicsbaseinfList(request);
            GraphicsbaseinfInfo defaultGraphicsbaseinf = response.Data.Find(a => a.Bz3 == "1");

            List <GraphicspointsinfInfo> graphicspointsinfList = new List <GraphicspointsinfInfo>();
            //GraphicspointsinfGetListRequest graphicspointsinfRequest = new GraphicspointsinfGetListRequest();
            var graphicsbaseinfResponse = graphicspointsinfService.GetAllGraphicspointsinfInfo();

            if (graphicsbaseinfResponse != null && graphicsbaseinfResponse.IsSuccess && defaultGraphicsbaseinf != null)
            {
                graphicspointsinfList = graphicsbaseinfResponse.Data.FindAll(g => g.GraphId == defaultGraphicsbaseinf.GraphId);
            }

            pointDefines.ForEach(pointDefine =>
            {
                if (positionList.Any())
                {
                    var area             = areaList.FirstOrDefault(a => a.Areaid == pointDefine.Areaid);
                    pointDefine.AreaName = area == null ? string.Empty : area.Areaname;
                    pointDefine.AreaLoc  = area == null ? string.Empty : area.Loc;
                }
                if (positionList.Any())
                {
                    var position   = positionList.FirstOrDefault(p => p.WzID == pointDefine.Wzid);
                    pointDefine.Wz = position == null ? string.Empty : position.Wz;
                }
                if (graphicspointsinfList.Any())
                {
                    //从通风系统默认图形中获取测点的默认坐标信息  20170829
                    var graphicspoint       = graphicspointsinfList.FirstOrDefault(g => g.Point.Contains(pointDefine.Point));
                    pointDefine.XCoordinate = graphicspoint == null ? string.Empty : graphicspoint.XCoordinate;
                    pointDefine.YCoordinate = graphicspoint == null ? string.Empty : graphicspoint.YCoordinate;
                }
                if (deviceDefineList.Any())
                {
                    var deviceDefine          = deviceDefineList.FirstOrDefault(g => g.Devid == pointDefine.Devid);
                    pointDefine.DevName       = deviceDefine == null ? string.Empty : deviceDefine.Name;
                    pointDefine.DevPropertyID = deviceDefine == null ? 0 : deviceDefine.Type;
                    pointDefine.DevClassID    = deviceDefine == null ? 0 : deviceDefine.Bz3;
                    pointDefine.DevModelID    = deviceDefine == null ? 0 : deviceDefine.Bz4;
                    pointDefine.Unit          = deviceDefine == null ? string.Empty : deviceDefine.Xs1;
                    //pointDefine.Sysid = deviceDefine != null ? 0 : deviceDefine.Sysid;//去掉  20171207
                }
                if (deviceClassList.Any())
                {
                    var deviceClass      = deviceClassList.FirstOrDefault(devc => devc.LngEnumValue == pointDefine.DevClassID);
                    pointDefine.DevClass = deviceClass == null ? string.Empty : deviceClass.StrEnumDisplay;
                }
                if (devicePropertyList.Any())
                {
                    var deviceProperty      = devicePropertyList.FirstOrDefault(devc => devc.LngEnumValue == pointDefine.DevPropertyID);
                    pointDefine.DevProperty = deviceProperty == null ? string.Empty : deviceProperty.StrEnumDisplay;
                }
                if (deviceTypeList.Any())
                {
                    var deviceType       = deviceTypeList.FirstOrDefault(devc => devc.LngEnumValue == pointDefine.DevModelID);
                    pointDefine.DevModel = deviceType == null ? string.Empty : deviceType.StrEnumDisplay;
                }
                pointDefine.ClsAlarmObj = new AlarmProperty();
                //加载分站最近正常通讯时间(开始置此时间,用来保证开机时不马上写分站中断记录)  20170722
                pointDefine.DttStateTime         = DateTime.Now;
                pointDefine.ClsCommObj           = new CommProperty(Convert.ToUInt32(pointDefine.Fzh));
                pointDefine.ClsFiveMinObj        = new FiveMinData();
                pointDefine.BCommDevTypeMatching = true;
                pointDefine.Alarm = 0;

                pointDefine.DataState = 46;
                pointDefine.State     = 46;

                pointDefine.DeviceControlItems = new List <ControlItem>();
                pointDefine.SoleCodingChanels  = new List <ControlItem>();
                if (pointDefine.DevPropertyID == 0)
                {
                    pointDefine.ClsCommObj.BInit = false;
                    pointDefine.sendIniCount     = 0;

                    pointDefine.LastAcceptFlag = 0;                                  //默认置0

                    pointDefine.StationFaultCount = 20;                              //起时将容错次数增大,以免分站误中断
                }
                pointDefine.GetDeviceSoleCoding     = 1;                             //2018.3.26 by 首次下发F命令必须带上获取分站唯一编码命令(K命令必须,I、J命令无影响)
                pointDefine.GetDeviceSoleCodingTime = DateTime.Now;                  //2018.3.29
                pointDefine.GradingAlarmItems       = new List <GradingAlarmItem>(); //2018.3.26 by 此处不加,则默认为null,会自动在开机时添加下发分级报警控制命令标记
                pointDefine.IsSendFCommand          = false;                         // 2018.3.26 by 默认未下发F命令,以保证开机时F命令至少下发一次


                if (pointDefine.DevPropertyID != 0)
                {
                    pointDefine.PointEditState = 3; //2018.4.9 by  系统启动后,在未收到初始化确认前,不解析传感器数据
                }
            });
        }
コード例 #6
0
        /// <summary>
        /// 保存
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void simpleButton2_Click(object sender, EventArgs e)
        {
            GraphOpt.IsTopologyInit = false;

            string suffixName     = "", //新图形后缀名
                   SGraphFileName = "", //原图形路径及图形名称
                   GraphFileName  = "", //新图形名称
                   distFileName   = ""; //新图形路径及图形名称

            try
            {
                if (textGraphName.Text.Length < 1)
                {
                    DevExpress.XtraEditors.XtraMessageBox.Show("请输入图形文件名称!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
                if (comboBoxType.SelectedItem == null)
                {
                    DevExpress.XtraEditors.XtraMessageBox.Show("请选择图形类型!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
                if (comboBoxType.SelectedItem.ToString() == "动态图")
                {
                    if (textFileName.Text.Length < 1)
                    {
                        DevExpress.XtraEditors.XtraMessageBox.Show("请选择图形文件底图!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        return;
                    }
                }
                //if (comboBoxType.SelectedItem.ToString() == "SVG组态图")
                //{
                //    if (textSCGFileName.Text.Length < 1)
                //    {
                //        DevExpress.XtraEditors.XtraMessageBox.Show("请输入本地目录SVG底图文件名称!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                //        return;
                //    }
                //}
                short Type = 0;
                if (comboBoxType.SelectedItem.ToString() == "拓扑图")
                {
                    Type = 1;
                }
                if (comboBoxType.SelectedItem.ToString() == "SVG组态图")
                {
                    Type = 3;
                }

                suffixName     = textFileName.Text.Substring(textFileName.Text.LastIndexOf(".") + 1, textFileName.Text.Length - textFileName.Text.LastIndexOf(".") - 1);
                SGraphFileName = Application.StartupPath + "\\mx\\dwg\\" + textGraphName.Text;
                if (comboBoxType.SelectedItem.ToString() == "动态图")
                {
                    if (textGraphName.Text.Contains("."))
                    {
                        GraphFileName = textGraphName.Text.Substring(0, textGraphName.Text.LastIndexOf('.')) + "." + suffixName;
                    }
                    else//未输入后缀名时,直接用输入的名称+后缀名
                    {
                        GraphFileName = textGraphName.Text + "." + suffixName;
                    }
                }
                else
                {
                    GraphFileName = textGraphName.Text;
                }
                distFileName = Application.StartupPath + "\\mx\\dwg\\" + GraphFileName;

                //图形保存到数据库中
                if (this.Text == "新建图形")
                {
                    //修改应急联动图形
                    if (!string.IsNullOrWhiteSpace(this.EmergencyLinkageGraphicsId))
                    {
                        GraphOpt.UpdateEmergencyLinkageGraphicsRequest(this.EmergencyLinkageGraphicsId);
                    }
                    if (Type == 0)
                    {
                        //查找目录下是否具有同名文件
                        if (File.Exists(distFileName))
                        {
                            DevExpress.XtraEditors.XtraMessageBox.Show("当前图形已存在,请进行编辑操作!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            return;
                        }
                        string bz3 = "0", bz4 = "0";
                        if (this.checkEdit2.Checked == true && this.checkEdit2.Text == "通风系统默认图形")
                        {
                            bz3 = "1";
                            bz4 = "1";//通风系统图与应急联动图同时选择  20171221
                            if (!string.IsNullOrWhiteSpace(this.SysetemDefaultGraphicsId))
                            {
                                GraphOpt.UpdateSystemDefaultGraphics("0", this.SysetemDefaultGraphicsId);
                            }
                        }
                        else if (this.checkEdit2.Checked == true && this.checkEdit2.Text == "拓扑定义默认图形")
                        {
                            bz3 = "2";
                            if (!string.IsNullOrWhiteSpace(this.SysetemDefaultGraphicsId))
                            {
                                GraphOpt.UpdateSystemDefaultGraphics("0", this.SysetemDefaultGraphicsId);
                            }
                        }

                        GraphOpt.GraphInsert(GraphFileName, Type, bz3, bz4, File.ReadAllBytes(textFileName.Text));
                    }
                    else
                    {
                        //查找数据库中是否有相同图形
                        GraphicsbaseinfInfo GraphicsbaseinfDTO_ = GraphOpt.getGraphicDto(GraphFileName);
                        if (GraphicsbaseinfDTO_ != null)
                        {
                            DevExpress.XtraEditors.XtraMessageBox.Show("当前图形已存在,请进行编辑操作!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            return;
                        }
                        else
                        {
                            if (comboBoxType.SelectedItem.ToString() == "SVG组态图")
                            {
                                string bz4 = "0";
                                //if (this.checkEdit3.Checked == true)
                                //{
                                //    bz4 = "1";
                                //}
                                //else if (this.checkEdit4.Checked == true)
                                //{
                                //    bz4 = "0";
                                //}
                                //GraphOpt.GraphInsert(GraphFileName, Type, bz4, null, "SVGLoad.html", textSCGFileName.Text);
                            }
                            else
                            {
                                string bz3 = "0", bz4 = "0";
                                if (this.checkEdit2.Checked == true && this.checkEdit2.Text == "通风系统默认图形")
                                {
                                    if (!string.IsNullOrWhiteSpace(this.SysetemDefaultGraphicsId))
                                    {
                                        GraphOpt.UpdateSystemDefaultGraphics("0", this.SysetemDefaultGraphicsId);
                                    }
                                    bz3 = "1";
                                    bz4 = "1";//通风系统图与应急联动图同时选择  20171221
                                }
                                else if (this.checkEdit2.Checked == true && this.checkEdit2.Text == "拓扑定义默认图形")
                                {
                                    if (!string.IsNullOrWhiteSpace(this.SysetemDefaultGraphicsId))
                                    {
                                        GraphOpt.UpdateSystemDefaultGraphics("0", this.SysetemDefaultGraphicsId);
                                    }
                                    bz3 = "2";
                                }
                                //if (this.checkEdit3.Checked == true)
                                //{
                                //    bz4 = "1";
                                //}
                                //else if (this.checkEdit4.Checked == true)
                                //{
                                //    bz4 = "0";
                                //}
                                GraphOpt.IsTopologyInit = true;
                                GraphOpt.GraphInsert(GraphFileName, Type, bz3, bz4, null);
                            }
                        }
                    }
                }
                else if (this.Text == "图形编辑")
                {
                    if (SGraphFileName != textFileName.Text)
                    {
                        //删除原来的图形
                        if (File.Exists(SGraphFileName))
                        {
                            File.Delete(SGraphFileName);
                        }
                    }
                    if (comboBoxType.SelectedItem.ToString() == "SVG组态图")
                    {
                        GraphOpt.GraphUpdate(textGraphName.Text, GraphFileName, Type, File.ReadAllBytes(textFileName.Text), "SVGLoad.html", textGraphName.Text);
                    }
                    else
                    {
                        string bz3 = "0", bz4 = "0";
                        if (this.checkEdit2.Checked == true && this.checkEdit2.Text == "通风系统默认图形")
                        {
                            bz3 = "1";
                            bz4 = "1";//通风系统图与应急联动图同时选择  20171221
                        }
                        else if (this.checkEdit2.Checked == true && this.checkEdit2.Text == "拓扑定义默认图形")
                        {
                            bz3 = "2";
                        }
                        //if (this.checkEdit3.Checked == true)
                        //{
                        //    bz4 = "1";
                        //}
                        //else if (this.checkEdit4.Checked == true)
                        //{
                        //    bz4 = "0";
                        //}

                        if (Type == 0)
                        {
                            //更新动态图形
                            GraphOpt.GraphUpdate(textGraphName.Text, GraphFileName, Type, bz3, bz4, File.ReadAllBytes(textFileName.Text));
                        }
                        else if (Type == 1)
                        {
                            //修改拓扑图形
                            GraphOpt.GraphUpdate(textGraphName.Text, GraphFileName, Type, bz3, bz4, null);
                        }
                    }
                }
                if (Type == 0)//只有动态图才进行底图保存
                {
                    if (SGraphFileName != textFileName.Text)
                    {
                        //保存本地
                        File.Copy(textFileName.Text, distFileName);
                    }
                }



                DevExpress.XtraEditors.XtraMessageBox.Show("系统默认图形上传成功!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.Close();
            }
            catch (Exception ex)
            {
                LogHelper.Error("GraphicsAdd_simpleButton2_Click" + ex.Message + ex.StackTrace);
            }
        }