Ejemplo n.º 1
0
        /// <summary>
        /// 开门
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnOpenDoor_Click(object sender, EventArgs e)
        {
            // 检查回转库编号的合理性
            if (string.IsNullOrEmpty(lblGroupNo.Text) || (Convert.ToInt32(lblGroupNo.Text) == 0))
            {
                MessageUtil.ShowWarning("回转库编号没有正确配置,请检查设置!");
                return;
            }

            // 执行开门指令
            try
            {
                // 开门命令
                OpenDoorCommand cmd = new OpenDoorCommand(Controller, Convert.ToInt32(lblGroupNo.Text));
                commandInvoker.AddCommand(cmd);

                // 执行命令
                commandInvoker.ExecuteCommand();
            }
            catch (Exception ex)
            {
                MessageUtil.ShowWarning(ex.Message);
                return;
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 根据表格的行信息执行控制
        /// </summary>
        /// <param name="model"></param>
        private void GetControlCommand(DeviceModel model, ref CommandInvoker cmdInvoker)
        {
            if (model == null)
            {
                return;
            }

            if (model.IsDoorOperate)
            {
                if (model.DoorOperateFlag == true)
                {
                    // 开门操作
                    OpenDoorCommand cmd = new OpenDoorCommand(Controller, model.DeviceNo);
                    cmdInvoker.AddCommand(cmd);
                }
                else
                {
                    // 关门操作
                    CloseDoorCommand cmd = new CloseDoorCommand(Controller, model.DeviceNo);
                    cmdInvoker.AddCommand(cmd);
                }
            }

            if (model.IsGoLayer)
            {
                // 走层操作
                RunCommand cmd = new RunCommand(Controller, model.DeviceNo);
                cmd.dstLayers = new int[1] {
                    model.DstLayerNo
                };
                cmdInvoker.AddCommand(cmd);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 全部开门
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnOpenDoor_Click(object sender, EventArgs e)
        {
            // 获得选中的行
            int[] selectedIdx = gvDeviceInfo.GetSelectedRows();

            foreach (int item in selectedIdx)
            {
                // 将选中行的信息转换为设备模型对象
                DeviceModel model = (DeviceModel)gvDeviceInfo.GetRow(item);

                // 生成开门命令
                OpenDoorCommand cmd = new OpenDoorCommand(Controller, model.DeviceNo);
                commandInvoker.AddCommand(cmd);
            }

            // 执行命令队列里的所有命令
            commandInvoker.ExecuteCommand();
        }
 public DoorController(OpenDoorCommand openDoorCommand, CloseDoorCommand closeDoorCommand, GetDoorDirectionQuery getDoorDirectionQuery)
 {
     _openDoorCommand       = openDoorCommand;
     _closeDoorCommand      = closeDoorCommand;
     _getDoorDirectionQuery = getDoorDirectionQuery;
 }