Exemplo n.º 1
0
        /// <summary>
        /// 车辆旋转(掉头)
        /// </summary>
        /// <returns></returns>
        public void VehicleRotation()
        {
            PushServiceClient push = new PushServiceClient(new System.ServiceModel.InstanceContext(CStaticClass.myCallback));

            push.VehicleRotation(m_nWareHouse);
            push.Close();
        }
Exemplo n.º 2
0
        /// <summary>
        /// 判断该库区是否有作业
        /// </summary>
        /// <returns>true:有作业  false:无作业</returns>
        public bool IsHasTask()
        {
            PushServiceClient push = new PushServiceClient(new System.ServiceModel.InstanceContext(CStaticClass.myCallback));
            bool bReturn           = push.IsHasTask(m_nWareHouse);

            push.Close();
            return(bReturn);
        }
Exemplo n.º 3
0
        /// <summary>
        /// 确认车辆掉头
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BtnRotation_Click(object sender, EventArgs e)
        {
            if (!CStaticClass.CheckPushService())
            {// 检查服务
                return;
            }

            QueryServiceClient proxy = new QueryServiceClient();
            PushServiceClient  push  = new PushServiceClient(new System.ServiceModel.InstanceContext(CStaticClass.myCallback));

            try
            {
                if (CBaseMethods.MyBase.IsEmpty(m_nWareHouse) || string.IsNullOrEmpty(this.CTxtSrcLocAddr.Text))
                {
                    MessageBox.Show("库区、源地址都不能为空!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                DialogResult dr = MessageBox.Show("确认车辆掉头?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Asterisk);

                if (dr == DialogResult.Cancel)
                {
                    return;
                }

                if (push.IsHasTask(m_nWareHouse))
                {
                    MessageBox.Show("当前库区有作业,不允许掉头!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
                CarLocationPanelLib.PushService.EnmFaultType type = push.VehicleRotationByAddr(m_nWareHouse, this.CTxtSrcLocAddr.Text.Trim());

                switch (type)
                {
                case CarLocationPanelLib.PushService.EnmFaultType.Success:
                {
                    MessageBox.Show("车辆掉头成功!", "成功", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                    this.Close();
                    break;
                }

                case CarLocationPanelLib.PushService.EnmFaultType.NotFoundEquip:
                {
                    MessageBox.Show("没有指定设备,需要确认库区号和设备号无误!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    break;
                }

                case CarLocationPanelLib.PushService.EnmFaultType.IsNotETVEquip:
                {
                    MessageBox.Show("要移动的设备不是ETV或TV设备!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    break;
                }

                case CarLocationPanelLib.PushService.EnmFaultType.NotAutomatic:
                {
                    MessageBox.Show("非全自动模式!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    break;
                }

                case CarLocationPanelLib.PushService.EnmFaultType.NotFoundCarPOSN:
                {
                    MessageBox.Show("无效目的地址,请选择一个有效的车位地址!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    break;
                }

                case CarLocationPanelLib.PushService.EnmFaultType.NotAvailable:
                {
                    MessageBox.Show("设备不可接收指令!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    break;
                }

                case CarLocationPanelLib.PushService.EnmFaultType.NotAllowed:
                {
                    MessageBox.Show("设备不可用!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    break;
                }

                case CarLocationPanelLib.PushService.EnmFaultType.InvalidWareHouseID:
                {
                    MessageBox.Show("无效库区号!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    break;
                }

                case CarLocationPanelLib.PushService.EnmFaultType.InvalidEquipID:
                {
                    MessageBox.Show("无效设备号!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    break;
                }

                case CarLocationPanelLib.PushService.EnmFaultType.FailToSendTelegram:
                {
                    MessageBox.Show("发送报文失败!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    break;
                }

                case CarLocationPanelLib.PushService.EnmFaultType.FailToUpdate:
                {
                    MessageBox.Show("更新数据库失败!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    break;
                }

                case CarLocationPanelLib.PushService.EnmFaultType.FailConnection:
                {
                    MessageBox.Show("PLC网络连接中断,请检查网络连接再继续", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    break;
                }

                case CarLocationPanelLib.PushService.EnmFaultType.Exception:
                {
                    MessageBox.Show(CStaticClass.GetExceptionInfo(null), "连接异常", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    break;
                }

                default:
                {
                    MessageBox.Show("车辆掉头失败", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    break;
                }
                }
            }
            catch (TimeoutException)
            {
                MessageBox.Show("The service operation timed out. ", "超时", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (FaultException exception)
            {
                MessageBox.Show(CStaticClass.GetExceptionInfo(exception), "SOAP错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (CommunicationException exception)
            {
                MessageBox.Show("There was a communication problem. " + CStaticClass.GetExceptionInfo(exception), "通信错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (Exception exception)
            {
                MessageBox.Show(CStaticClass.GetExceptionInfo(exception), "应用程序异常", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            proxy.Close();
            push.Close();
        }
        /// <summary>
        /// 制卡时, 逻辑卡号不一致确认是否修改逻辑卡号
        /// </summary>
        private void ModifyICCardID(string strPhysicalCardID, string strData)
        {
            if (!CStaticClass.CheckPushService())
            {// 检查服务
                return;
            }

            QueryServiceClient proxy = new QueryServiceClient();
            PushServiceClient  push  = new PushServiceClient(new System.ServiceModel.InstanceContext(CStaticClass.myCallback));

            try
            {
                string       str = string.Format("当前卡片已经是本系统卡,确认是否将用户卡号修改为{0}?", strData);//用户卡号是{1},
                DialogResult dr  = MessageBox.Show(str, "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Asterisk);

                if (dr == DialogResult.Cancel)
                {
                    return;
                }

                CarLocationPanelLib.PushService.EnmFaultType type = push.ModifyICCardID(strPhysicalCardID, strData);

                switch (type)
                {
                // 修改成功
                case CarLocationPanelLib.PushService.EnmFaultType.Success:
                {
                    MessageBox.Show("修改成功!", "成功", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                    break;
                }

                // 当前IC卡没有制卡
                case CarLocationPanelLib.PushService.EnmFaultType.NoICCardInfo:
                {
                    MessageBox.Show("当前IC卡未制卡:" + strData, "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    break;
                }

                // 更新数据库失败
                case CarLocationPanelLib.PushService.EnmFaultType.FailToUpdate:
                {
                    MessageBox.Show("更新数据库失败", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    break;
                }

                // 传入的参数卡号为空
                case CarLocationPanelLib.PushService.EnmFaultType.Null:
                {
                    MessageBox.Show("传入的参数卡号为空", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    break;
                }

                // IC卡注销或挂失
                case CarLocationPanelLib.PushService.EnmFaultType.LossORCancel:
                {
                    MessageBox.Show("IC卡注销或挂失", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    break;
                }

                // IC卡类型不正确
                case CarLocationPanelLib.PushService.EnmFaultType.NotMatch:
                {
                    MessageBox.Show("IC卡类型不正确", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    break;
                }

                case CarLocationPanelLib.PushService.EnmFaultType.Exception:
                {
                    MessageBox.Show(CStaticClass.GetExceptionInfo(null), "连接异常", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    break;
                }

                default:
                {
                    MessageBox.Show("修改失败", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    break;
                }
                }
            }
            catch (TimeoutException)
            {
                MessageBox.Show("The service operation timed out. ", "超时", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (FaultException exception)
            {
                MessageBox.Show(CStaticClass.GetExceptionInfo(exception), "SOAP错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (CommunicationException exception)
            {
                MessageBox.Show("There was a communication problem. " + CStaticClass.GetExceptionInfo(exception), "通信错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (Exception exception)
            {
                MessageBox.Show(CStaticClass.GetExceptionInfo(exception), "应用程序异常", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            proxy.Close();
            push.Close();
        }
Exemplo n.º 5
0
        /// <summary>
        /// 确定手动指令
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BtnOk_Click(object sender, EventArgs e)
        {
            if (!CStaticClass.CheckPushService())
            {// 检查服务
                return;
            }

            QueryServiceClient proxy = new QueryServiceClient();
            PushServiceClient  push  = new PushServiceClient(new System.ServiceModel.InstanceContext(CStaticClass.myCallback));

            try
            {
                if (string.IsNullOrEmpty(this.CboWareHouse.Text))
                {
                    MessageBox.Show("库区不能为空!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
                int nWareHouse = CStaticClass.ConvertWareHouse(this.CboWareHouse.Text);

                if (this.RbtnInJog.Checked)
                {
                    DialogResult dr = MessageBox.Show("确认车辆挪移?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Asterisk);

                    if (dr == DialogResult.Cancel)
                    {
                        return;
                    }
                    #region 车辆挪移
                    if (string.IsNullOrEmpty(this.CTxtSrcLocAddr.Text) || string.IsNullOrEmpty(this.CTxtDestLocAddr.Text))
                    {
                        MessageBox.Show("源地址、目的地址都不能为空!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        return;
                    }

                    CarLocationPanelLib.PushService.EnmFaultType type = push.VehicleMove(nWareHouse, this.CTxtSrcLocAddr.Text.Trim(), this.CTxtDestLocAddr.Text.Trim());

                    switch (type)
                    {
                    case CarLocationPanelLib.PushService.EnmFaultType.Success:
                    {
                        MessageBox.Show("车辆挪移成功!", "成功", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                        this.Close();
                        break;
                    }

                    case CarLocationPanelLib.PushService.EnmFaultType.NotFoundEquip:
                    {
                        MessageBox.Show("没有空闲设备,分配设备失败!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        break;
                    }

                    case CarLocationPanelLib.PushService.EnmFaultType.NotFoundCarPOSN:
                    {
                        MessageBox.Show("指定的源或目的车位不存在!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        break;
                    }

                    case CarLocationPanelLib.PushService.EnmFaultType.NotNormalCarPOSN:
                    {
                        MessageBox.Show("源车位或目的车位不是正常车位!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        break;
                    }

                    case CarLocationPanelLib.PushService.EnmFaultType.HallEquip:
                    {
                        MessageBox.Show("源车位或目的车位是车厅!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        break;
                    }

                    case CarLocationPanelLib.PushService.EnmFaultType.NoCarInGarage:
                    {
                        MessageBox.Show("源车位没有车!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        break;
                    }

                    case CarLocationPanelLib.PushService.EnmFaultType.CarInGarage:
                    {
                        MessageBox.Show("目的车位有车!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        break;
                    }

                    case CarLocationPanelLib.PushService.EnmFaultType.TaskOnICCard:
                    {
                        MessageBox.Show("目的车位的车辆正在作业!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        break;
                    }

                    case CarLocationPanelLib.PushService.EnmFaultType.NoICCardInfo:
                    {
                        MessageBox.Show("源车位的IC卡没有制卡!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        break;
                    }

                    case CarLocationPanelLib.PushService.EnmFaultType.FixedCarPOSN:
                    {
                        MessageBox.Show("目的车位是其他车主的固定车位,临时卡或定期卡无法挪移到固定车位卡的车位上!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        break;
                    }

                    case CarLocationPanelLib.PushService.EnmFaultType.OverCarInSize:
                    {
                        MessageBox.Show("目的车位尺寸无法满足源车位的车辆!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        break;
                    }

                    case CarLocationPanelLib.PushService.EnmFaultType.InvalidWareHouseID:
                    {
                        MessageBox.Show("无效库区号!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        break;
                    }

                    case CarLocationPanelLib.PushService.EnmFaultType.InvalidEquipID:
                    {
                        MessageBox.Show("无效设备!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        break;
                    }

                    case CarLocationPanelLib.PushService.EnmFaultType.NotMatch:
                    {
                        MessageBox.Show("目的车位是其他车主的固定车位!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        break;
                    }

                    case CarLocationPanelLib.PushService.EnmFaultType.NotAvailable:
                    {
                        MessageBox.Show("设备不可接收指令!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        break;
                    }

                    case CarLocationPanelLib.PushService.EnmFaultType.FailToSendTelegram:
                    {
                        MessageBox.Show("发送报文失败!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        break;
                    }

                    case CarLocationPanelLib.PushService.EnmFaultType.FailToUpdate:
                    {
                        MessageBox.Show("更新数据库失败!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        break;
                    }

                    case CarLocationPanelLib.PushService.EnmFaultType.FailConnection:
                    {
                        MessageBox.Show("PLC网络连接中断,请检查网络连接再继续", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        break;
                    }

                    case CarLocationPanelLib.PushService.EnmFaultType.Exception:
                    {
                        MessageBox.Show(CStaticClass.GetExceptionInfo(null), "连接异常", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        break;
                    }

                    default:
                    {
                        MessageBox.Show("车辆挪移失败", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        break;
                    }
                    }
                    #endregion
                }
                else if (this.RbtnMove.Checked)
                {
                    DialogResult dr = MessageBox.Show("确认移动设备?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Asterisk);

                    if (dr == DialogResult.Cancel)
                    {
                        return;
                    }
                    #region 移动设备
                    if (string.IsNullOrEmpty(this.CboDeviceID.Text) || string.IsNullOrEmpty(this.CTxtDestLocAddr.Text))
                    {
                        MessageBox.Show("设备、目的地址都不能为空!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        return;
                    }

                    int nEquipID = CStaticClass.ConvertETVDescp(this.CboDeviceID.Text);
                    CarLocationPanelLib.PushService.EnmFaultType type = push.EquipMove(nWareHouse, nEquipID, this.CTxtDestLocAddr.Text);

                    switch (type)
                    {
                    case CarLocationPanelLib.PushService.EnmFaultType.Success:
                    {
                        MessageBox.Show("移动设备成功!", "成功", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                        this.Close();
                        break;
                    }

                    case CarLocationPanelLib.PushService.EnmFaultType.NotFoundEquip:
                    {
                        MessageBox.Show("没有指定设备,需要确认库区号和设备号无误!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        break;
                    }

                    case CarLocationPanelLib.PushService.EnmFaultType.IsNotETVEquip:
                    {
                        MessageBox.Show("要移动的设备不是ETV或TV设备!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        break;
                    }

                    case CarLocationPanelLib.PushService.EnmFaultType.NotAutomatic:
                    {
                        MessageBox.Show("非全自动模式!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        break;
                    }

                    case CarLocationPanelLib.PushService.EnmFaultType.NotFoundCarPOSN:
                    {
                        MessageBox.Show("无效目的地址,请选择一个有效的车位地址!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        break;
                    }

                    case CarLocationPanelLib.PushService.EnmFaultType.NotAvailable:
                    {
                        MessageBox.Show("设备不可接收指令!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        break;
                    }

                    case CarLocationPanelLib.PushService.EnmFaultType.NotAllowed:
                    {
                        MessageBox.Show("设备不可用!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        break;
                    }

                    case CarLocationPanelLib.PushService.EnmFaultType.InvalidWareHouseID:
                    {
                        MessageBox.Show("无效库区号!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        break;
                    }

                    case CarLocationPanelLib.PushService.EnmFaultType.InvalidEquipID:
                    {
                        MessageBox.Show("无效设备号!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        break;
                    }

                    case CarLocationPanelLib.PushService.EnmFaultType.FailToSendTelegram:
                    {
                        MessageBox.Show("发送报文失败!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        break;
                    }

                    case CarLocationPanelLib.PushService.EnmFaultType.FailToUpdate:
                    {
                        MessageBox.Show("更新数据库失败!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        break;
                    }

                    case CarLocationPanelLib.PushService.EnmFaultType.FailConnection:
                    {
                        MessageBox.Show("PLC网络连接中断,请检查网络连接再继续", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        break;
                    }

                    case CarLocationPanelLib.PushService.EnmFaultType.Exception:
                    {
                        MessageBox.Show(CStaticClass.GetExceptionInfo(null), "连接异常", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        break;
                    }

                    default:
                    {
                        MessageBox.Show("移动设备失败", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        break;
                    }
                    }
                    #endregion
                }
                else if (this.RbtnOut.Checked)
                {
                    DialogResult dr = MessageBox.Show("确认车辆出库?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Asterisk);

                    if (dr == DialogResult.Cancel)
                    {
                        return;
                    }
                    #region 车辆出库
                    if (string.IsNullOrEmpty(this.CTxtSrcLocAddr.Text) || string.IsNullOrEmpty(this.CboHallID.Text))
                    {
                        MessageBox.Show("源地址、出库车厅都不能为空!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        return;
                    }

                    CarLocationPanelLib.PushService.EnmFaultType type = push.VehicleExit(nWareHouse, this.CTxtSrcLocAddr.Text, CStaticClass.ConvertHallDescp(nWareHouse, this.CboHallID.Text).ToString());

                    switch (type)
                    {
                    case CarLocationPanelLib.PushService.EnmFaultType.Success:
                    {
                        MessageBox.Show("车辆出库成功!", "成功", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                        this.Close();
                        break;
                    }

                    case CarLocationPanelLib.PushService.EnmFaultType.NotFoundCarPOSN:
                    {
                        MessageBox.Show("指定的源车位不存在!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        break;
                    }

                    case CarLocationPanelLib.PushService.EnmFaultType.NotFoundEquip:
                    {
                        MessageBox.Show("没有找到指定目的车厅!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        break;
                    }

                    case CarLocationPanelLib.PushService.EnmFaultType.IsNotHallEquip:
                    {
                        MessageBox.Show("指定的目的地址不是车厅!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        break;
                    }

                    case CarLocationPanelLib.PushService.EnmFaultType.HallEnter:
                    {
                        MessageBox.Show("车厅是进车厅不允许出车!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        break;
                    }

                    case CarLocationPanelLib.PushService.EnmFaultType.NotAvailable:
                    {
                        MessageBox.Show("当前卡没有车存在车库!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        break;
                    }

                    case CarLocationPanelLib.PushService.EnmFaultType.NoCarInGarage:
                    {
                        MessageBox.Show("车厅设备不可接收指令!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        break;
                    }

                    case CarLocationPanelLib.PushService.EnmFaultType.FailToSendTelegram:
                    {
                        MessageBox.Show("发送报文失败!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        break;
                    }

                    case CarLocationPanelLib.PushService.EnmFaultType.FailToInsert:
                    {
                        MessageBox.Show("插入数据库失败!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        break;
                    }

                    case CarLocationPanelLib.PushService.EnmFaultType.TaskOnICCard:
                    case CarLocationPanelLib.PushService.EnmFaultType.Exit:
                    {
                        MessageBox.Show("正在为您出车,请稍后!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        break;
                    }

                    case CarLocationPanelLib.PushService.EnmFaultType.Wait:
                    {
                        MessageBox.Show("已经将您加到取车队列,请排队等候!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        break;
                    }

                    case CarLocationPanelLib.PushService.EnmFaultType.Add:
                    {
                        MessageBox.Show("前面有人正在取车,已经将您加到取车队列,请排队等候!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        break;
                    }

                    case CarLocationPanelLib.PushService.EnmFaultType.InvalidEquipID:
                    {
                        MessageBox.Show("无效设备号!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        break;
                    }

                    case CarLocationPanelLib.PushService.EnmFaultType.InvalidWareHouseID:
                    {
                        MessageBox.Show("无效库区号!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        break;
                    }

                    case CarLocationPanelLib.PushService.EnmFaultType.NotNormalCarPOSN:
                    {
                        MessageBox.Show("源车位不是正常车位!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        break;
                    }

                    case CarLocationPanelLib.PushService.EnmFaultType.FailConnection:
                    {
                        MessageBox.Show("PLC网络连接中断,请检查网络连接再继续", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        break;
                    }

                    case CarLocationPanelLib.PushService.EnmFaultType.Exception:
                    {
                        MessageBox.Show(CStaticClass.GetExceptionInfo(null), "连接异常", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        break;
                    }

                    default:
                    {
                        MessageBox.Show("车辆出库失败", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        break;
                    }
                    }
                    #endregion
                }
                else
                {
                    MessageBox.Show("请选择具体动作指令!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
            }
            catch (TimeoutException)
            {
                MessageBox.Show("The service operation timed out. ", "超时", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (FaultException exception)
            {
                MessageBox.Show(CStaticClass.GetExceptionInfo(exception), "SOAP错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (CommunicationException exception)
            {
                MessageBox.Show("There was a communication problem. " + CStaticClass.GetExceptionInfo(exception), "通信错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (Exception exception)
            {
                MessageBox.Show(CStaticClass.GetExceptionInfo(exception), "应用程序异常", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            proxy.Close();
            push.Close();
        }
        /// <summary>
        /// 换卡
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BtnICCardChange_Click(object sender, EventArgs e)
        {
            if (!CStaticClass.CheckPushService())
            {// 检查服务
                return;
            }
            if (CTxtICCardIDFind.Text.Trim().Length != 4)
            {
                MessageBox.Show("请输入四位用户卡号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                return;
            }

            QueryServiceClient proxy = new QueryServiceClient();
            PushServiceClient  push  = new PushServiceClient(new System.ServiceModel.InstanceContext(CStaticClass.myCallback));

            try
            {
                CarLocationPanelLib.PushService.EnmFaultType type = CarLocationPanelLib.PushService.EnmFaultType.Fail;
                if (this.CTxtICCardIDOld.Visible)
                {
                    if (string.IsNullOrEmpty(this.CTxtICCardIDFind.Text) || string.IsNullOrEmpty(this.CTxtICCardIDOld.Text))
                    {
                        MessageBox.Show("用户卡号、换卡旧卡号都不能为空!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        return;
                    }

                    string strICCardID    = CStaticClass.ConvertICCardID(this.CTxtICCardIDFind.Text.Trim());
                    string strICCardIDOld = CStaticClass.ConvertICCardID(this.CTxtICCardIDOld.Text.Trim());
                    ClearICCardControls();

                    type = push.ModifyICCard(strICCardIDOld, strICCardID);
                    this.TxtICCardID.Text      = strICCardID; // 用户卡号
                    this.CTxtICCardIDFind.Text = strICCardID; // 用户卡号
                }
                else
                {
                    if (string.IsNullOrEmpty(this.CTxtICCardIDFind.Text))
                    {
                        MessageBox.Show("用户卡号不能为空!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        return;
                    }

                    string strPhysicalCardID = this.TxtICCardPhy.Text.Trim();
                    string strICCardID       = CStaticClass.ConvertICCardID(this.CTxtICCardIDFind.Text.Trim());
                    ClearICCardControls();

                    type = push.ModifyPhyCard(strPhysicalCardID, strICCardID);
                    this.TxtICCardID.Text      = strICCardID; // 用户卡号
                    this.CTxtICCardIDFind.Text = strICCardID; // 用户卡号
                }

                switch (type)
                {
                // 换卡成功
                case CarLocationPanelLib.PushService.EnmFaultType.Success:
                {
                    MessageBox.Show("换卡成功!", "成功", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                    break;
                }

                // 传入的参数卡号为空
                case CarLocationPanelLib.PushService.EnmFaultType.Null:
                {
                    MessageBox.Show("传入的参数卡号为空!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    break;
                }

                // 当前IC卡未制卡
                case CarLocationPanelLib.PushService.EnmFaultType.NoICCardInfo:
                {
                    MessageBox.Show("当前IC卡未制卡!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    break;
                }

                // IC卡注销或挂失
                case CarLocationPanelLib.PushService.EnmFaultType.LossORCancel:
                {
                    MessageBox.Show("IC卡注销或挂失!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    break;
                }

                // IC卡类型不正确
                case CarLocationPanelLib.PushService.EnmFaultType.NotMatch:
                {
                    MessageBox.Show("IC卡类型不正确!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    break;
                }

                // 新的IC卡有绑定用户
                case CarLocationPanelLib.PushService.EnmFaultType.BoundUser:
                {
                    MessageBox.Show("新的IC卡有绑定用户!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    break;
                }

                // 旧卡或新卡正在作业
                case CarLocationPanelLib.PushService.EnmFaultType.TaskOnICCard:
                {
                    MessageBox.Show("旧卡或新卡正在作业!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    break;
                }

                // 旧卡或新卡正在排队取车
                case CarLocationPanelLib.PushService.EnmFaultType.Wait:
                {
                    MessageBox.Show("旧卡或新卡正在排队取车!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    break;
                }

                // 新的IC卡有车存在车库
                case CarLocationPanelLib.PushService.EnmFaultType.CarInGarage:
                {
                    MessageBox.Show("新的IC卡有车存在车库!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    break;
                }

                // 更新数据库失败
                case CarLocationPanelLib.PushService.EnmFaultType.FailToUpdate:
                {
                    MessageBox.Show("更新数据库失败!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    break;
                }

                case CarLocationPanelLib.PushService.EnmFaultType.Exception:
                {
                    MessageBox.Show(CStaticClass.GetExceptionInfo(null), "连接异常", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    break;
                }

                default:
                {
                    MessageBox.Show("换卡失败", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    break;
                }
                }
            }
            catch (TimeoutException)
            {
                MessageBox.Show("The service operation timed out. ", "超时", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (FaultException exception)
            {
                MessageBox.Show(CStaticClass.GetExceptionInfo(exception), "SOAP错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (CommunicationException exception)
            {
                MessageBox.Show("There was a communication problem. " + CStaticClass.GetExceptionInfo(exception), "通信错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (Exception exception)
            {
                MessageBox.Show(CStaticClass.GetExceptionInfo(exception), "应用程序异常", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            proxy.Close();
            push.Close();
        }
Exemplo n.º 7
0
        /// <summary>
        /// 确认临时取物
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BtnOk_Click(object sender, EventArgs e)
        {
            if (!CStaticClass.CheckPushService())
            {// 检查服务
                return;
            }

            QueryServiceClient proxy = new QueryServiceClient();
            PushServiceClient  push  = new PushServiceClient(new System.ServiceModel.InstanceContext(CStaticClass.myCallback));

            try
            {
                int nWareHouse = CStaticClass.ConvertWareHouse(this.CboWareHouse.Text);          // -1;
                int nHallID    = CStaticClass.ConvertHallDescp(nWareHouse, this.CboHallID.Text); // -1

                if (string.IsNullOrEmpty(this.TxtICCardID.Text))
                {
                    MessageBox.Show("用户卡号不能为空", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                if (string.IsNullOrEmpty(this.CboHallID.Text) || string.IsNullOrEmpty(this.CboWareHouse.Text) || 0 > nHallID || 0 > nWareHouse)
                {
                    MessageBox.Show("出车库区、出车车厅都不能为空", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                if (this.CboWareHouse.Text.Contains("塔库"))
                { // 塔库无临时取物
                    MessageBox.Show("塔库无临时取物!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                DialogResult dr = MessageBox.Show("确认临时取物?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Asterisk);

                if (dr == DialogResult.Cancel)
                {
                    return;
                }
                string strICCardID = this.TxtICCardID.Text.Trim();
                CarLocationPanelLib.PushService.EnmFaultType type = push.TmpFetch(strICCardID, nWareHouse, nHallID);
                CLOGException.Trace("CFormTempFetch 临时取物 nWareHouse:" + nWareHouse + "strICCardID:" + strICCardID);

                switch (type)
                {
                case CarLocationPanelLib.PushService.EnmFaultType.Success:
                {
                    MessageBox.Show(CStaticClass.ConvertHallDescp(nWareHouse, nHallID) + "出车", "成功", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                    this.Close();
                    break;
                }

                case CarLocationPanelLib.PushService.EnmFaultType.Null:
                {
                    MessageBox.Show("传入的参数卡号为空", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    break;
                }

                case CarLocationPanelLib.PushService.EnmFaultType.NoICCardInfo:
                {
                    MessageBox.Show("没有制卡", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    break;
                }

                case CarLocationPanelLib.PushService.EnmFaultType.LossORCancel:
                {
                    MessageBox.Show("IC卡注销或挂失", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    break;
                }

                case CarLocationPanelLib.PushService.EnmFaultType.NotMatch:
                {
                    MessageBox.Show("IC卡类型不正确", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    break;
                }

                case CarLocationPanelLib.PushService.EnmFaultType.NoCarInGarage:
                {
                    MessageBox.Show("当前卡没有车存在车库", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    break;
                }

                case CarLocationPanelLib.PushService.EnmFaultType.NotFoundEquip:
                {
                    MessageBox.Show("没有找到指定设备", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    break;
                }

                case CarLocationPanelLib.PushService.EnmFaultType.NotAvailable:
                {
                    MessageBox.Show("车厅不可接收指令", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    break;
                }

                case CarLocationPanelLib.PushService.EnmFaultType.IsNotHallEquip:
                {
                    MessageBox.Show("指定的设备不是车厅", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    break;
                }

                case CarLocationPanelLib.PushService.EnmFaultType.EquipIncorrect:
                {
                    MessageBox.Show("车厅不是进出两用车厅", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    break;
                }

                case CarLocationPanelLib.PushService.EnmFaultType.FailToSendTelegram:
                {
                    MessageBox.Show("发送报文失败", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    break;
                }

                case CarLocationPanelLib.PushService.EnmFaultType.InvalidWareHouseID:
                {
                    MessageBox.Show("无效库区号", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    break;
                }

                case CarLocationPanelLib.PushService.EnmFaultType.InvalidEquipID:
                {
                    MessageBox.Show("无效设备号", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    break;
                }

                case CarLocationPanelLib.PushService.EnmFaultType.NotAutomatic:
                {
                    MessageBox.Show("非全自动模式", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    break;
                }

                case CarLocationPanelLib.PushService.EnmFaultType.FailToInsert:
                {
                    MessageBox.Show("插入数据库失败", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    break;
                }

                case CarLocationPanelLib.PushService.EnmFaultType.TaskOnICCard:
                {
                    MessageBox.Show("正在为您作业,请稍后", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    break;
                }

                case CarLocationPanelLib.PushService.EnmFaultType.Wait:
                {
                    MessageBox.Show("已经将您加到取车队列,请排队等候", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    break;
                }

                case CarLocationPanelLib.PushService.EnmFaultType.Add:
                {
                    MessageBox.Show("前面有人正在取车,已经将您加到取车队列,请排队等候", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    break;
                }

                case CarLocationPanelLib.PushService.EnmFaultType.FailConnection:
                {
                    MessageBox.Show("PLC网络连接中断,请检查网络连接再继续", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    break;
                }

                case CarLocationPanelLib.PushService.EnmFaultType.Exception:
                {
                    MessageBox.Show(CStaticClass.GetExceptionInfo(null), "连接异常", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    break;
                }

                default:
                {
                    MessageBox.Show("临时取物失败", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    break;
                }
                }
            }
            catch (TimeoutException)
            {
                MessageBox.Show("The service operation timed out. ", "超时", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (FaultException exception)
            {
                MessageBox.Show(CStaticClass.GetExceptionInfo(exception), "SOAP错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (CommunicationException exception)
            {
                MessageBox.Show("There was a communication problem. " + CStaticClass.GetExceptionInfo(exception), "通信错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (Exception exception)
            {
                MessageBox.Show(CStaticClass.GetExceptionInfo(exception), "应用程序异常", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            proxy.Close();
            push.Close();
        }
        /// <summary>
        /// 禁用
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BtnDisable_Click(object sender, EventArgs e)
        {
            if (!CStaticClass.CheckPushService())
            {// 检查服务
                return;
            }

            QueryServiceClient proxy = new QueryServiceClient();
            PushServiceClient  push  = new PushServiceClient(new System.ServiceModel.InstanceContext(CStaticClass.myCallback));

            try
            {
                if (string.IsNullOrEmpty(this.CboEquipWareHouse.Text) || string.IsNullOrEmpty(this.CboEquipID.Text))
                {
                    MessageBox.Show("库区,设备都不能为空!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                int nEquipID   = CStaticClass.ConvertETVDescp(this.CboEquipID.Text);
                int nWareHouse = CStaticClass.ConvertWareHouse(this.CboEquipWareHouse.Text);
                CarLocationPanelLib.PushService.EnmFaultType type = push.SetDeviceMode(nWareHouse, nEquipID, 0);

                switch (type)
                {
                case CarLocationPanelLib.PushService.EnmFaultType.Success:
                {
                    CSystemLogDto log = new CSystemLogDto();
                    log.curtime  = CStaticClass.CurruntDateTime();
                    log.logdescp = "禁用设备成功:设备号-" + nEquipID + " 库号-" + nWareHouse;
                    log.optcode  = CStaticClass.myOperator.optcode;
                    log.optname  = CStaticClass.myOperator.optname;
                    proxy.InsertSysLog(log);
                    MessageBox.Show("禁用设备成功!", "成功", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                    break;
                }

                case CarLocationPanelLib.PushService.EnmFaultType.NotFoundEquip:
                {
                    MessageBox.Show("没有找到指定设备!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    break;
                }

                case CarLocationPanelLib.PushService.EnmFaultType.NotAllowed:
                {
                    MessageBox.Show("设备当前状态与要修改的状态相同!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    break;
                }

                case CarLocationPanelLib.PushService.EnmFaultType.FailToUpdate:
                {
                    MessageBox.Show("更新数据库失败!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    break;
                }

                case CarLocationPanelLib.PushService.EnmFaultType.Exception:
                {
                    MessageBox.Show(CStaticClass.GetExceptionInfo(null), "连接异常", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    break;
                }

                default:
                {
                    MessageBox.Show("禁用设备失败!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    break;
                }
                }
            }
            catch (TimeoutException)
            {
                MessageBox.Show("The service operation timed out. ", "超时", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (FaultException exception)
            {
                MessageBox.Show(CStaticClass.GetExceptionInfo(exception), "SOAP错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (CommunicationException exception)
            {
                MessageBox.Show("There was a communication problem. " + CStaticClass.GetExceptionInfo(exception), "通信错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (Exception exception)
            {
                MessageBox.Show(CStaticClass.GetExceptionInfo(exception), "应用程序异常", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            proxy.Close();
            push.Close();
        }
        /// <summary>
        /// 车厅设置确认
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BtnOk_Click(object sender, EventArgs e)
        {
            if (!CStaticClass.CheckPushService())
            {// 检查服务
                return;
            }

            QueryServiceClient proxy = new QueryServiceClient();
            PushServiceClient  push  = new PushServiceClient(new System.ServiceModel.InstanceContext(CStaticClass.myCallback));

            try
            {
                if (string.IsNullOrEmpty(this.CboHallWareHouse.Text) || string.IsNullOrEmpty(this.CboHallID.Text) || 0 > this.CboHallType.SelectedIndex)
                {
                    MessageBox.Show("库区,车厅设备以及车厅类型都不能为空!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                DialogResult dr = MessageBox.Show("确定修改吗?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Asterisk);

                if (dr == DialogResult.OK)
                {
                    int         nWareHouse  = CStaticClass.ConvertWareHouse(this.CboHallWareHouse.Text);
                    int         nHallID     = CStaticClass.ConvertHallDescp(nWareHouse, this.CboHallID.Text);
                    EnmHallType enmHallType = CStaticClass.ConvertHallType(this.CboHallType.Text);
                    CarLocationPanelLib.PushService.EnmFaultType type = push.SetHallType(nWareHouse, nHallID, enmHallType);

                    switch (type)
                    {
                    case CarLocationPanelLib.PushService.EnmFaultType.Success:
                    {
                        MessageBox.Show("设置车厅类型成功!", "成功", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                        break;
                    }

                    case CarLocationPanelLib.PushService.EnmFaultType.NotFoundEquip:
                    {
                        MessageBox.Show("没有找到指定的车厅!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        break;
                    }

                    case CarLocationPanelLib.PushService.EnmFaultType.WorkQueueNotEmpty:
                    {
                        MessageBox.Show("有人排队取车,不允许修改车厅类型!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        break;
                    }

                    case CarLocationPanelLib.PushService.EnmFaultType.FailToUpdate:
                    {
                        MessageBox.Show("修改数据库失败!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        break;
                    }

                    case CarLocationPanelLib.PushService.EnmFaultType.InvalidWareHouseID:
                    {
                        MessageBox.Show("无效库区号!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        break;
                    }

                    case CarLocationPanelLib.PushService.EnmFaultType.FailToSendTelegram:
                    {
                        MessageBox.Show("发送报文失败!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        break;
                    }

                    case CarLocationPanelLib.PushService.EnmFaultType.FailConnection:
                    {
                        MessageBox.Show("PLC网络连接中断,请检查网络连接再继续", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        break;
                    }

                    case CarLocationPanelLib.PushService.EnmFaultType.Exception:
                    {
                        MessageBox.Show(CStaticClass.GetExceptionInfo(null), "连接异常", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        break;
                    }

                    default:
                    {
                        MessageBox.Show("设置车厅类型失败!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        break;
                    }
                    }
                }
            }
            catch (TimeoutException)
            {
                MessageBox.Show("The service operation timed out. ", "超时", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (FaultException exception)
            {
                MessageBox.Show(CStaticClass.GetExceptionInfo(exception), "SOAP错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (CommunicationException exception)
            {
                MessageBox.Show("There was a communication problem. " + CStaticClass.GetExceptionInfo(exception), "通信错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (Exception exception)
            {
                MessageBox.Show(CStaticClass.GetExceptionInfo(exception), "应用程序异常", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            proxy.Close();
            push.Close();
        }
Exemplo n.º 10
0
        /// <summary>
        /// 启用
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BtnEnable_Click(object sender, EventArgs e)
        {
            if (!CStaticClass.CheckPushService())
            {// 检查服务
                return;
            }

            QueryServiceClient proxy = new QueryServiceClient();
            PushServiceClient  push  = new PushServiceClient(new System.ServiceModel.InstanceContext(CStaticClass.myCallback));

            try
            {
                if (string.IsNullOrEmpty(this.CboEquipWareHouse.Text) || string.IsNullOrEmpty(this.CboEquipID.Text))
                {
                    MessageBox.Show("库区,设备都不能为空!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                DialogResult dr = MessageBox.Show("确认启用?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Asterisk);

                if (dr == DialogResult.Cancel)
                {
                    return;
                }

                int nEquipID   = CStaticClass.ConvertETVDescp(this.CboEquipID.Text);
                int nWareHouse = CStaticClass.ConvertWareHouse(this.CboEquipWareHouse.Text);
                CarLocationPanelLib.PushService.EnmFaultType type = push.SetDeviceMode(nWareHouse, nEquipID, 1);

                switch (type)
                {
                case CarLocationPanelLib.PushService.EnmFaultType.Success:
                {
                    CSystemLogDto log = new CSystemLogDto();
                    log.curtime  = CStaticClass.CurruntDateTime();
                    log.logdescp = "启用设备成功:设备号-" + nEquipID + " 库号-" + nWareHouse;
                    log.optcode  = CStaticClass.myOperator.optcode;
                    log.optname  = CStaticClass.myOperator.optname;
                    proxy.InsertSysLog(log);
                    MessageBox.Show("启用设备成功!", "成功", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                    break;
                }

                case CarLocationPanelLib.PushService.EnmFaultType.NotFoundEquip:
                {
                    MessageBox.Show("没有找到指定设备!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    break;
                }

                case CarLocationPanelLib.PushService.EnmFaultType.NotAutomatic:
                {
                    MessageBox.Show("设备非全自动模式不能启用!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    break;
                }

                case CarLocationPanelLib.PushService.EnmFaultType.NotAllowed:
                {
                    MessageBox.Show("设备当前状态与要修改的状态相同!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    break;
                }

                case CarLocationPanelLib.PushService.EnmFaultType.FailToUpdate:
                {
                    MessageBox.Show("更新数据库失败!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    break;
                }

                case CarLocationPanelLib.PushService.EnmFaultType.InvalidWareHouseID:
                {
                    MessageBox.Show("无效库区号!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    break;
                }

                case CarLocationPanelLib.PushService.EnmFaultType.Null:
                {        //下一取车队列的传入的参数卡号为空
                    MessageBox.Show("无取车排队队列!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    break;
                }

                case CarLocationPanelLib.PushService.EnmFaultType.NoICCardInfo:
                {
                    MessageBox.Show("下一取车队列的IC卡没有制卡!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    break;
                }

                case CarLocationPanelLib.PushService.EnmFaultType.LossORCancel:
                {
                    MessageBox.Show("下一取车队列的IC卡注销或挂失!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    break;
                }

                case CarLocationPanelLib.PushService.EnmFaultType.NotMatch:
                {
                    MessageBox.Show("下一取车队列的IC卡类型不正确!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    break;
                }

                case CarLocationPanelLib.PushService.EnmFaultType.NoCarInGarage:
                {
                    MessageBox.Show("下一取车队列的用户没有车存在库内!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    break;
                }

                case CarLocationPanelLib.PushService.EnmFaultType.FailToSendTelegram:
                {
                    MessageBox.Show("下一取车队列发送报文失败, 请重新刷卡取车!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    break;
                }

                case CarLocationPanelLib.PushService.EnmFaultType.WorkQueueNotEmpty:
                {
                    CSystemLogDto log = new CSystemLogDto();
                    log.curtime  = CStaticClass.CurruntDateTime();
                    log.logdescp = "启用成功,正在为取车排队的车主取车,请稍后片刻:设备号-" + nEquipID + " 库号-" + nWareHouse;
                    log.optcode  = CStaticClass.myOperator.optcode;
                    log.optname  = CStaticClass.myOperator.optname;
                    proxy.InsertSysLog(log);
                    MessageBox.Show("启用成功,正在为取车排队的车主取车,请稍后片刻!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    break;
                }

                case CarLocationPanelLib.PushService.EnmFaultType.Exception:
                {
                    MessageBox.Show(CStaticClass.GetExceptionInfo(null), "连接异常", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    break;
                }

                default:
                {
                    MessageBox.Show("启用设备失败!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    break;
                }
                }
            }
            catch (TimeoutException)
            {
                MessageBox.Show("The service operation timed out. ", "超时", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (FaultException exception)
            {
                MessageBox.Show(CStaticClass.GetExceptionInfo(exception), "SOAP错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (CommunicationException exception)
            {
                MessageBox.Show("There was a communication problem. " + CStaticClass.GetExceptionInfo(exception), "通信错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (Exception exception)
            {
                MessageBox.Show(CStaticClass.GetExceptionInfo(exception), "应用程序异常", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            proxy.Close();
            push.Close();
        }