Exemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        private void SendTask()
        {
            #region SendNow

            List <int> selectTar = GetSelectedTars();

            if (selectTar == null || selectTar.Count < 1)
            {
                MessageBox.Show("未选择有效任务", "提示");

                return;
            }

            ///构建任务
            TaskDispatch task = new TaskDispatch();

            task.Descip = _clientMark;

            TaskPathNode node = null;

            int lastTar = 0;

            ///添加任务节点
            foreach (var item in selectTar)
            {
                node = new TaskPathNode("", item, false);

                task.TaskPathNode.Add(node);

                lastTar = item;
            }

            ///启动本地AGV
            task.StartSiteList.Add(LocSite.ToString());

            ///执行任务
            if (MessageBox.Show(string.Format("确定要执行任务【{0}】", textBoxNextTars.Text), "提示", MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes)
            {
                WcfDispatchHelper.InitPara(_severIp, "", "");

                string result = WcfDispatchHelper.IStartTaskDispatch(task);

                if (result != "s")
                {
                    SetOutputMsg(result);

                    MessageBox.Show("当前没有空闲AGV," + "请稍后再试!", "提示");
                }
                else
                {
                    ResetBackCorlor();

                    SetOutputMsg(string.Format("开启新任务"));

                    MessageBox.Show("派发任务成功,点击启动开始运行!", "提示");
                }
            }
            #endregion
        }
Exemplo n.º 2
0
        /// <summary>
        /// 返回待命点
        /// </summary>
        private void BackWaitPoint()
        {
            #region BackWaitPoint
            StationMember staMem = GetRelateMember(_locTar);

            if (staMem == null)
            {
                MessageBox.Show("没有配置相关的站点,请检查!", "提示");

                return;
            }

            ///构建任务
            TaskDispatch task = new TaskDispatch();

            task.Descip = _clientMark;

            TaskPathNode node = null;

            int lastTar = 0;

            ///添加任务节点
            foreach (var item in staMem.BackTarList)
            {
                node = new TaskPathNode("", item, false);

                task.TaskPathNode.Add(node);

                lastTar = item;
            }

            ///启动本地AGV
            task.StartSiteList.Add(LocSite.ToString());

            ///执行任务
            if (MessageBox.Show(string.Format("确定要返回待命点?"), "提示", MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes)
            {
                WcfDispatchHelper.InitPara(_severIp, "", "");

                string result = WcfDispatchHelper.IStartTaskDispatch(task);

                if (result != "s")
                {
                    SetOutputMsg(result);

                    MessageBox.Show("当前没有空闲AGV," + "请稍后再试!", "提示");
                }
                else
                {
                    ResetBackCorlor();

                    SetOutputMsg(string.Format("开启新任务"));

                    MessageBox.Show("派发任务成功,点击启动开始运行!", "提示");
                }
            }
            #endregion
        }
Exemplo n.º 3
0
        /// <summary>
        /// 呼叫AGV
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void buttonCallAGv_Click(object sender, EventArgs e)
        {
            try
            {
                if (_isCalling)
                {
                    MessageBox.Show("AGV过来的途中,请等待!", "提示"); return;
                }

                TaskDispatch task = new TaskDispatch();

                task.Descip = _clientMark;

                StationMember sta = _staDic.Values.ToList().Find(c => { return(c.StaSite == LocSite); });

                if (sta == null)
                {
                    MessageBox.Show("未找到与本客户端绑定的站点", "提示"); return;
                }

                TaskPathNode node = new TaskPathNode(sta.StaSite.ToString(), sta.StaTarget, true);

                task.TaskPathNode.Add(node);

                if (sta != null && sta.WaitList != null)
                {
                    foreach (var item in sta.WaitList)
                    {
                        task.StartSiteList.Add(item.ToString());
                    }
                }

                if (task.StartSiteList == null || task.StartSiteList.Count < 1)
                {
                    MessageBox.Show("未正确配置其相应的待命点,请检查配置!", "提示");

                    return;
                }

                if (MessageBox.Show(string.Format("确定要呼叫AGV到【{0}】位置", sta.StaTarget), "提示", MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes)
                {
                    WcfDispatchHelper.InitPara(_severIp, "", "");

                    string result = WcfDispatchHelper.IStartTaskDispatch(task);

                    SetOutputMsg(string.Format("开启新任务"));

                    if (result != "s")
                    {
                        SetOutputMsg(result);

                        MessageBox.Show("当前没有空闲的AGV,请稍后再试!", "提示");
                    }
                    else
                    {
                        _isCalling = true;

                        _callingTask = task;

                        DispatchBackMember disback = WcfMainHelper.GetDispatch(task.DisGuid);

                        if (disback != null)
                        {
                            _callingAGV = disback.DisDevId;

                            DeviceBackImf devback = WcfMainHelper.GetDev(_callingAGV);

                            if (devback != null)
                            {
                                _callingSite = devback.SensorList.Find(c => { return(c.SenId == string.Format("{0}0002", devback.DevId)); }).RValue;
                            }
                            else
                            {
                                _callingSite = null;
                            }
                        }
                        else
                        {
                            _callingAGV = null;
                        }

                        MessageBox.Show("呼叫成功,请等待AGV过来!", "提示");
                    }
                }
            }
            catch { }
        }