private void btnRdICCard_Click(object sender, EventArgs e) { CTxtSrcLocAddr.Clear(); string physCode = this.readIccard(); if (physCode == null) { return; } if (!CStaticClass.CheckPushService()) { return; } QueryServiceClient proxy = new QueryServiceClient(); try { string iccode = proxy.QueryICCodeByPhysic(physCode); if (iccode != null) { CarLocationPanelLib.QueryService.CCarLocationDto carLoc = null; CarLocationPanelLib.QueryService.EnmFaultType type = proxy.QueryCarPOSNByCardID(out carLoc, iccode); if (type == CarLocationPanelLib.QueryService.EnmFaultType.Success) { if (carLoc != null) { this.CTxtSrcLocAddr.Text = carLoc.carlocaddr; return; } } } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } proxy.Close(); }
/// <summary> /// 根据逻辑卡号查询车位 /// </summary> /// <param name="strICCardID"></param> private void QueryCarPOSN(string strICCardID) { if (!CStaticClass.CheckPushService()) {// 检查服务 return; } QueryServiceClient proxy = new QueryServiceClient(); try { // 查询当前卡车位 CarLocationPanelLib.QueryService.CCarLocationDto carLoc = new CarLocationPanelLib.QueryService.CCarLocationDto(); CarLocationPanelLib.QueryService.EnmFaultType type = proxy.QueryCarPOSNByCardID(out carLoc, strICCardID); this.CboHallID.Text = null; // ""; this.CboWareHouse.Text = null; // ""; switch (type) { case CarLocationPanelLib.QueryService.EnmFaultType.Success: { if (null == carLoc) { MessageBox.Show("当前用户没有存车!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else if (carLoc.carloctype != (int)EnmLocationType.Normal || carLoc.carlocstatus != (int)CarLocationPanelLib.PushService.EnmLocationStatus.Occupy) { MessageBox.Show("该卡存车的车位非正常占用车位!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { this.CboWareHouse.Text = CStaticClass.ConvertWareHouse(carLoc.warehouse); //.ToString(); MessageBox.Show("查询IC卡成功!", "成功", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } break; } // 获取的逻辑卡号是空值 case CarLocationPanelLib.QueryService.EnmFaultType.Null: { MessageBox.Show("传入的参数卡号为空", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning); break; } // 没有制卡 case CarLocationPanelLib.QueryService.EnmFaultType.NoICCardInfo: { MessageBox.Show("没有制卡", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning); break; } // IC卡注销或挂失 case CarLocationPanelLib.QueryService.EnmFaultType.LossORCancel: { MessageBox.Show("IC卡注销或挂失", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning); break; } // 当前IC卡没有存车 case CarLocationPanelLib.QueryService.EnmFaultType.NotFoundCarPOSN: { MessageBox.Show("当前IC卡没有存车", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning); break; } case CarLocationPanelLib.QueryService.EnmFaultType.Exception: { MessageBox.Show(CStaticClass.GetExceptionInfo(null), "连接异常", MessageBoxButtons.OK, MessageBoxIcon.Error); break; } default: { MessageBox.Show("查询IC卡失败!", "警告", 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(); }