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