/// <summary>
        /// 保存
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void simpleButton1_Click(object sender, EventArgs e)
        {
            try
            {
                //判断当前修改的地址号是否已经存在  20170909
                PointDefineGetByStationIDChannelIDRequest pointDefineGetByStationIDChannelIDRequest = new PointDefineGetByStationIDChannelIDRequest();
                pointDefineGetByStationIDChannelIDRequest.StationID = ushort.Parse(_stationNumber);
                pointDefineGetByStationIDChannelIDRequest.ChannelID = (byte)DeviceChanelNumberNew.Value;
                Jc_DefInfo tempDef = pointDefineService.GetPointDefineCacheByStationIDChannelID(pointDefineGetByStationIDChannelIDRequest).Data.Find(a => a.DevPropertyID == 1 || a.DevPropertyID == 2);
                if (tempDef != null)
                {
                    XtraMessageBox.Show("当前修改的通道已经定义了其它设备!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                DeviceAddressModificationRequest request = new DeviceAddressModificationRequest();

                List <DeviceAddressModificationItem> deviceAddressModificationItems = new List <DeviceAddressModificationItem>();
                DeviceAddressModificationItem        deviceAddressModificationItem  = new DeviceAddressModificationItem();
                deviceAddressModificationItem.fzh = ushort.Parse(_stationNumber);

                List <DeviceAddressItem> modificationItems = new List <DeviceAddressItem>();

                DeviceAddressItem editDeviceAdressItem = new DeviceAddressItem();
                editDeviceAdressItem.SoleCoding         = DeviceOnlyCode.Text;
                editDeviceAdressItem.BeforeModification = byte.Parse(DeviceChanelNumberNow.Text);
                editDeviceAdressItem.AfterModification  = (byte)DeviceChanelNumberNew.Value;
                editDeviceAdressItem.DeviceType         = (byte)_devType;

                modificationItems.Add(editDeviceAdressItem);

                deviceAddressModificationItem.DeviceAddressItem = modificationItems;
                deviceAddressModificationItems.Add(deviceAddressModificationItem);

                request.DeviceAddressModificationItems = deviceAddressModificationItems;

                var result = pointDefineService.ModificationDeviceAdressRequest(request);

                //删除等待  20180408
                //var wdf = new WaitDialogForm("正在下发命令...", "请等待...");
                //Thread.Sleep(30000);
                //if (wdf != null)
                //    wdf.Close();

                if (result.IsSuccess)
                {
                    XtraMessageBox.Show("下发成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    this.Close();//下发成功后,关闭页面  20180408
                }
            }
            catch (Exception ex)
            {
                LogHelper.Error(ex);
            }
        }
 public BasicResponse ModificationDeviceAdressRequest(DeviceAddressModificationRequest request)
 {
     return(_PointDefineService.ModificationDeviceAdressRequest(request));
 }
Exemple #3
0
        public BasicResponse ModificationDeviceAdressRequest(DeviceAddressModificationRequest request)
        {
            var responseStr = HttpClientHelper.Post(Webapi + "/v1/PointDefine/ModificationDeviceAdressRequest?token=" + Token, JSONHelper.ToJSONString(request));

            return(JSONHelper.ParseJSONString <BasicResponse>(responseStr));
        }