Exemple #1
0
        /// <summary>
        /// 检测调度状态
        /// </summary>
        private void CheckDispatch()
        {
            WcfMainHelper.InitPara(_severIp, "", "");

            List <DispatchBackMember> result = WcfMainHelper.GetDispatchList();

            if (result != null)
            {
                foreach (var item in result)
                {
                    if (item.TaskImf == _clientMark && item.OrderStatue == ResultTypeEnum.Suc)
                    {
                        WcfMainHelper.CtrDispatch(item.DisGuid, DisOrderCtrTypeEnum.Stop);
                    }
                }

                if (_callingTask != null)
                {
                    if (result.Find(c => { return(c.DisGuid == _callingTask.DisGuid); }) == null)
                    {
                        _callingTask = null;
                    }
                }
            }

            if (_callingTask == null)
            {
                _isCalling = false;
            }
        }
Exemple #2
0
        /// <summary>
        /// 返回区域二附近的待命点
        /// </summary>
        private void BackToPointAround()
        {
            if (_devArea2 == null)
            {
                return;
            }

            if (_devTarWait == null)
            {
                WcfMainHelper.InitPara(_severIp, "", "");

                List <DispatchBackMember> diss = WcfMainHelper.GetDispatchList();

                List <DeviceBackImf> devs = WcfMainHelper.GetDevList();

                foreach (var item in _waitAreaTwoList)
                {
                    if ((!IsDispatchContainPath(diss, item.StaTarget)) && (!IsDevOnSite(devs, item.StaSite)))
                    {
                        _devTarWait = item;

                        break;
                    }
                }
            }

            if (_devTarWait != null)
            {
                WcfMainHelper.InitPara(_severIp, "", "");

                DeviceBackImf result = WcfMainHelper.GetDev(_devArea2.DevId);

                if (result != null)
                {
                    if (result.SensorList.Find(c => { return(c.SenId == string.Format("{0}0003", _devArea2.DevId)); }).RValue == _devTarWait.StaTarget.ToString())
                    {
                        _devTarWait = null;

                        _devArea2 = null;
                    }
                    else
                    {
                        WcfMainHelper.SendOrder(_devArea2.DevId, new CommonDeviceOrderObj(DeviceOrderTypeEnum.OrderIndexThree, _devTarWait.StaTarget));
                    }
                }
            }
        }
Exemple #3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void buttonSendRun_Click(object sender, EventArgs e)
        {
            WcfMainHelper.InitPara(_severIp, "", "");

            List <DeviceBackImf> devs = WcfMainHelper.GetDevList();

            SensorBackImf sens = null;

            if (devs != null && devs.Count > 0)
            {
                foreach (var item in devs)
                {
                    if (item.DevType == "AGV")
                    {
                        sens = item.SensorList.Find(c => { return(c.SenId == string.Format("{0}0002", item.DevId)); });

                        if (sens != null && sens.RValue == LocSite.ToString())
                        {
                            if (MessageBox.Show(string.Format("确定要启动【{0}】地标上AGV【{1}】", LocSite, item.DevId), "提示", MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes)
                            {
                                if (WcfMainHelper.SendOrder(item.DevId, new CommonDeviceOrderObj("定点启动" + LocSite, 1)))
                                {
                                    SetOutputMsg(string.Format("启动【{0}】地标上AGV【{1}】", LocSite, item.DevId));

                                    MessageBox.Show("启动成功!", "提示");
                                }
                                else
                                {
                                    MessageBox.Show("请尝试再操作一次", "提示");
                                }
                            }

                            return;
                        }
                    }
                }
            }
            else
            {
                SetOutputMsg(string.Format("未获取到服务端的AGV"));
            }

            SetOutputMsg(string.Format("地标【{0}】上未找到AGV", LocSite));

            MessageBox.Show(string.Format("地标【{0}】上未找到AGV", LocSite), "提示");
        }
Exemple #4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ClientForm_FormClosing(object sender, FormClosingEventArgs e)
        {
            WcfMainHelper.InitPara(_severIp, "", "");

            List <DispatchBackMember> result = WcfMainHelper.GetDispatchList();

            if (result != null)
            {
                _isCalling = false;

                foreach (var item in result)
                {
                    if (item.TaskImf == _clientMark)
                    {
                        MessageBox.Show("当前还有任务未完成,不允许关闭客户端!", "提示");

                        e.Cancel = true;

                        return;
                    }
                }
            }

            if (_devArea2 != null || _isCalling)
            {
                MessageBox.Show("当前还有任务未完成,不允许关闭客户端!", "提示");

                e.Cancel = true;

                return;
            }


            if (MessageBox.Show("确定关闭客户端?", "提示", MessageBoxButtons.YesNo) != System.Windows.Forms.DialogResult.Yes)
            {
                e.Cancel = true;
            }
        }
Exemple #5
0
        /// <summary>
        ///  初始化参数
        /// </summary>
        public void InitPara()
        {
            _severIp = "192.168.6.79";

            WcfMainHelper.InitPara(_severIp, "", "");
        }
Exemple #6
0
 /// <summary>
 ///  初始化参数
 /// </summary>
 public void InitPara()
 {
     _severIp = "192.168.6.79"; // 吕超电脑的IP
     //_severIp = "127.0.0.1";
     WcfMainHelper.InitPara(_severIp, "", "");
 }
Exemple #7
0
        /// <summary>
        ///  初始化参数
        /// </summary>
        public void InitPara()
        {
            _severIp = "127.0.0.1";

            WcfMainHelper.InitPara(_severIp, "", "");
        }
Exemple #8
0
        /// <summary>
        /// 初始化参数
        /// </summary>
        private void InitPara()
        {
            string Section = "ShowConfig";

            int num = 0;

            #region  钮宽度
            string key = "BtnWidth";

            string read = ConfigHelper.IniReadValue(Section, key, 100);

            if (string.IsNullOrEmpty(read))
            {
                read = _btnWidth.ToString();

                ConfigHelper.IniWriteValue(Section, key, read);
            }

            if (Int32.TryParse(read, out num))
            {
                _btnWidth = num;
            }
            #endregion

            #region  钮高度
            key = "BtnHeight";

            read = ConfigHelper.IniReadValue(Section, key, 100);

            if (string.IsNullOrEmpty(read))
            {
                read = _btnHeight.ToString();

                ConfigHelper.IniWriteValue(Section, key, read);
            }

            if (Int32.TryParse(read, out num))
            {
                _btnHeight = num;
            }
            #endregion

            #region 横向距离
            key = "XDis";

            read = ConfigHelper.IniReadValue(Section, key, 100);

            if (string.IsNullOrEmpty(read))
            {
                read = _xDis.ToString();

                ConfigHelper.IniWriteValue(Section, key, read);
            }

            if (Int32.TryParse(read, out num))
            {
                _xDis = num;
            }
            #endregion

            #region 纵向距离
            key = "YDis";

            read = ConfigHelper.IniReadValue(Section, key, 100);

            if (string.IsNullOrEmpty(read))
            {
                read = _yDis.ToString();

                ConfigHelper.IniWriteValue(Section, key, read);
            }

            if (Int32.TryParse(read, out num))
            {
                _yDis = num;
            }
            #endregion

            #region 起始坐标

            int x = 0, y = 0;

            key = "StartPoint_X";

            read = ConfigHelper.IniReadValue(Section, key, 100);

            if (string.IsNullOrEmpty(read))
            {
                read = x.ToString();

                ConfigHelper.IniWriteValue(Section, key, read);
            }

            if (Int32.TryParse(read, out num))
            {
                x = num;
            }


            key = "StartPoint_Y";

            read = ConfigHelper.IniReadValue(Section, key, 100);

            if (string.IsNullOrEmpty(read))
            {
                read = y.ToString();

                ConfigHelper.IniWriteValue(Section, key, read);
            }

            if (Int32.TryParse(read, out num))
            {
                y = num;
            }

            _startLoc = new Point(x, y);
            #endregion

            #region 客户端配置
            Section = "CientConfig";

            key = "LoctionSite";

            read = ConfigHelper.IniReadValue(Section, key, 100);

            if (string.IsNullOrEmpty(read))
            {
                read = "-1";

                ConfigHelper.IniWriteValue(Section, key, read);
            }

            Int32.TryParse(read, out _locTar);

            key = "SeverIP";

            _severIp = ConfigHelper.IniReadValue(Section, key, 100);

            if (string.IsNullOrEmpty(_severIp))
            {
                _severIp = "127.0.0.1";

                ConfigHelper.IniWriteValue(Section, key, _severIp);
            }
            #endregion

            WcfDispatchHelper.InitPara(_severIp, "", "");

            WcfMainHelper.InitPara(_severIp, "", "");

            WcfTaskHelper.InitPara(_severIp, "", "");

            _clientMark = string.Format("微科创新_客户端【{0}】", _locTar);

            this.Text = string.Format("{0} IP:{1}", _clientMark, IPHelper.GetLocalIntranetIP());
        }
Exemple #9
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void buttonAlter_Click(object sender, EventArgs e)
        {
            if (_isLogin)
            {
                #region
                if (buttonAlter.Text != "保  存")
                {
                    WcfMainHelper.InitPara(_severIp, "", "");

                    List <DispatchBackMember> result = WcfMainHelper.GetDispatchList();

                    if (_devArea2 != null)
                    {
                        MessageBox.Show("当前客户端目前有派发任务未完成,不允许修改!", "提示");

                        return;
                    }

                    if (result != null)
                    {
                        foreach (var item in result)
                        {
                            if (item.TaskImf == _clientMark)
                            {
                                MessageBox.Show("当前客户端目前有派发任务未完成,不允许修改!", "提示");

                                return;
                            }
                        }
                    }

                    buttonAlter.Text = "保  存";

                    textBoxCurTar.ReadOnly = false;
                }
                else
                {
                    if (Int32.TryParse(textBoxCurTar.Text, out _locTar))
                    {
                        buttonAlter.Text = "修 改";

                        textBoxCurTar.ReadOnly = true;

                        string Section = "CientConfig";

                        string key = "LoctionSite";

                        ConfigHelper.IniWriteValue(Section, key, _locTar.ToString());

                        InitPara();

                        MessageBox.Show("修改成功!", "提示");
                    }
                    else
                    {
                        MessageBox.Show("输入站点格式有误!", "提示");
                    }
                }
                #endregion
            }
            else
            {
                MessageBox.Show("请先登录后再操作!", "提示");
            }
        }