/// <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(); }