/// <summary> /// 取消订单 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnCancelOrder_Click(object sender, EventArgs e) { string showMsg = ""; try { //扩展参数 ParamEx pe = new ParamEx(); pe.UsePIDChannel = this.KongZhiXiTong != null && this.KongZhiXiTong.Contains("|48|") ? 2 : 0; //发送指令管理类 SendInsManage SendIns = new SendInsManage(mUser.LoginName, mCompany.UninCode, pe, configparam); string id = Hid_id.Value; //订单id Tb_Ticket_Order Order = new Tb_Ticket_OrderBLL().GetTicketOrderById(id); if (Order != null) ////判断订单状态 { bool restult = true; //白屏预订 新订单等待支付 并且开启退废票(分离、取消)编码的权限 才取消编码 if (Order.OrderSourceType == 1 && Order.OrderStatusCode == 1 && KongZhiXiTong.Contains("|32|")) { #region 1.白屏预订2.新订单等待支付3.开启退废票(分离、取消)编码的权限 判断是否需要取消编码 if (Hid_isCancelPnr.Value == "1") // 取消编码 { Hid_isCancelPnr.Value = "0"; if (Order.PNR != "") { string ErrMsg = ""; PnrAnalysis.PnrModel pnrModel = SendIns.GetPnr(Order.PNR, out ErrMsg); //编码状态不是已经出票的PNR if (pnrModel != null && !pnrModel.PnrStatus.Contains("RR")) { //调用取消编码的方法 restult = SendIns.CancelPnr(Order.PNR, Order.Office); } } showMsg = restult == true ? "取消编码成功!" : showMsg; } else { showMsg = "取消订单,用户需要保留编码!"; } #endregion } else { showMsg = "取消订单"; } //取消订单 restult = new PbProject.Logic.Order.Tb_Ticket_OrderBLL().CancelOrder(Order, mUser, mCompany, showMsg); if (restult) { OrderListDataBind(); showMsg = "取消订单成功!"; } else { showMsg = "取消订单失败!"; } } else { showMsg = "该订单不能取消!!!"; } } catch (Exception ex) { showMsg = "操作失败"; } ScriptManager.RegisterStartupScript(this, GetType(), DateTime.Now.Ticks.ToString(), "showdialog('" + showMsg + "');", true); }
/// <summary> /// 分离或者取消编码 /// </summary> /// <returns></returns> private string PnrHandle(Tb_Ticket_Order Order, SendInsManage SendIns, StringBuilder sbLog, List <HashObject> selList, int INFCount) { string ErrMsg = ""; try { if (Order != null && Order.PNR != "" && Order.PNR.Trim().Length == 6) { PnrAnalysis.PnrModel pnrMode = SendIns.GetPnr(Order.PNR.Trim(), out ErrMsg); if (pnrMode != null) { if (ErrMsg.Contains("授权")) { string[] strAuthArr = ErrMsg.Split('#')[1].Split('|'); ErrMsg = ""; foreach (string item in strAuthArr) { ErrMsg += "RMK TJ AUTH " + item + "<br/>"; } ErrMsg = "需要授权,授权指令:<br />" + ErrMsg; sbLog.Append("提取编码信息失败," + ErrMsg); } else { if (!pnrMode.PnrStatus.Contains("XX")) { if (pnrMode.PnrStatus.Contains("NO")) { ErrMsg = "编码(" + Order.PNR + ")状态为NO,系统取消编码失败!"; sbLog.Append(ErrMsg); } else if (pnrMode.PnrStatus.Contains("RR")) { ErrMsg = "编码(" + Order.PNR + ")状态为RR,该编码已出票,不能取消!"; sbLog.Append(ErrMsg); } else { string TicketNumber = ""; string Cmd = "", Office = "", RecvData = ""; //用于分离编码的乘客姓名 不含婴儿 List <string> pnameList = new List <string>(); //循环选择的乘机人 foreach (HashObject hashParam in selList) { if (hashParam["pasPType"].ToString() != "3") { pnameList.Add(hashParam["pasName"].ToString()); } TicketNumber = hashParam["pasTicketNum"].ToString(); if (TicketNumber != "" && !KongZhiXiTong.Contains("|69|")) { Office = hashParam["office"].ToString(); Cmd = "DETR:TN/" + TicketNumber; RecvData = SendIns.Send(Cmd, ref Office, 0); if (!RecvData.Contains("OPEN FOR USE")) { ErrMsg = "票号(" + TicketNumber + ")状态异常,不能提交申请!"; sbLog.Append(ErrMsg); break; } } } //没有出错时 if (ErrMsg == "") { if (INFCount > 0) { //编码状态不是已经出票的PNR if (pnrMode != null && !pnrMode.PnrStatus.Contains("RR")) { //有婴儿直接提交 SendIns.CancelPnr(Order.PNR, Order.Office); } } else { //编码状态不是已经出票的PNR if (pnrMode != null) { if (!pnrMode.PnrStatus.Contains("RR")) { //取消编码 if (SendIns.CancelPnr(Order.PNR, Order.Office)) { ErrMsg = ""; } else { ErrMsg = "取消编码(" + Order.PNR + ")失败!"; } } else { ErrMsg = "编码状态为RR的编码,不能取消!"; } } } } } } } } else { sbLog.Append("提取编码信息失败,系统取消编码失败!"); } } else { sbLog.Append("订单不存在!"); } } catch (Exception ex) { ErrMsg = ex.Message; } finally { } return(ErrMsg); }
/// <summary> /// 返回数据 /// </summary> /// <param name="fromcity">起飞城市三字码</param> /// <param name="tocity">抵达城市三字码</param> /// <param name="totime">起飞时间</param> /// <param name="arrtime">抵达时间</param> /// <param name="starttime">起飞日期</param> /// <param name="cw">舱位</param> /// <param name="aircode">航空公司</param> /// <param name="aircono">航班号</param> /// <param name="fd">返点</param> /// <param name="strYh">现返</param> /// <param name="hidId">GUID</param> /// <param name="Fare">固定特价</param> /// <param name="TAX">基建</param> /// <param name="RQFare">燃油</param> /// <param name="isGuding">是否固定特价</param> /// <param name="Yprice">是否固定特价</param> private SpecialPrice PlyMatch(UserLoginInfo userInfo, string fromcity, string tocity, string totime, string arrtime, string starttime, string cw, string aircode, string aircono, string fd, string strYh, string hidId, string Fare, string TAX, string RQFare, bool isGuding, string Yprice ) { SpecialPrice sp = new SpecialPrice(); try { string[] strValue = new string[4]; //非固定特价PATA数据 if (!isGuding) { #region pat 数据 // ig|SS MU747/X/30NOV/KMGSHANN1/0730 1025|pat:a&kmg226#1 //发送指令获取 DateTime dt = DateTime.Parse(starttime); string cmd = "SS " + aircode + aircono + "/" + cw + "/" + dt.ToString("R").Substring(4, 7).Replace(" ", "") + dt.Year.ToString().Substring(2) + "/" + fromcity + tocity + "NN1/" + totime.Replace(":", "") + " " + arrtime.Replace(":", "") + "|pat:a"; string zhiling = cmd; string strVale = string.Empty; //---------修改部分---------- if (userInfo.Configparam != null) { //开启使用特价缓存 true 开启 false关闭 bool IsUseSpCache = userInfo.FQP.KongZhiXiTong != null && userInfo.FQP.KongZhiXiTong.Contains("|99|"); //特价缓存 SpecialCabinPriceInfoBLL SpBll = new SpecialCabinPriceInfoBLL(); Tb_SpecialCabin_PriceInfo PriceInfo = null; if (IsUseSpCache) { SpBll.GetSpPrice(aircode, aircono, DateTime.Parse(starttime + " " + totime + ":00"), fromcity, tocity, cw); } if (PriceInfo == null) { //格式化编码内容类 PnrAnalysis.FormatPNR pnrformat = new PnrAnalysis.FormatPNR(); //扩展参数 ParamEx pe = new ParamEx(); pe.UsePIDChannel = userInfo.FQP.KongZhiXiTong != null && userInfo.FQP.KongZhiXiTong.Contains("|48|") ? 2 : 0; SendInsManage SendManage = new SendInsManage(userInfo.User.LoginName, userInfo.Company.UninCode, pe, userInfo.Configparam); string Office = userInfo.Configparam.Office.Split('^')[0]; strVale = SendManage.Send(cmd, ref Office, 15);//发送获取特价指令 string error = ""; decimal spFare = 0m, spABFare = 0m, spRQFare = 0m; //价格实体 PnrAnalysis.PatModel Pat = pnrformat.GetPATInfo(strVale, out error); if (Pat != null && Pat.UninuePatList.Count > 0) { strValue[0] = Pat.UninuePatList[0].Fare; //舱位价 strValue[1] = Pat.UninuePatList[0].TAX; //基建 strValue[2] = Pat.UninuePatList[0].RQFare; //燃油 strValue[3] = Pat.UninuePatList[0].Price; //总计(舱位价+基建+燃油) decimal.TryParse(strValue[0], out spFare); decimal.TryParse(strValue[1], out spABFare); decimal.TryParse(strValue[2], out spRQFare); } else { //-----------------2013-5-6添加---------------------------------------------- //没有PAT出价格 预订一个编码PAT价格后取消PNR 即使编码没有取消 后台程序自动取消 string ErrMsg = ""; if (ConfigIsSet(out ErrMsg)) { //----------构造航段和乘客--------------- List <Tb_Ticket_Passenger> pList = GetPassengerList(); List <Tb_Ticket_SkyWay> skywaylist = new List <Tb_Ticket_SkyWay>(); Tb_Ticket_SkyWay sky = new Tb_Ticket_SkyWay(); sky.CarryCode = aircode; sky.FlightCode = aircono; sky.FromDate = DateTime.Parse(starttime + " " + totime + ":00"); sky.ToDate = DateTime.Parse(starttime + " " + arrtime + ":00"); sky.FromCityCode = fromcity; sky.ToCityCode = tocity; sky.Space = cw; skywaylist.Add(sky); //------------------------- //预订编码 获取价格 RePnrObj pnrObj = GetPnrInfo(aircode, pList, skywaylist, out ErrMsg); string AdultPnr = string.Empty; Log_Pnr logAdultPnr = null; //成人预订信息编码记录 if (pnrObj.AdultYudingList.Count > 0) { AdultPnr = pnrObj.AdultPnr; if (string.IsNullOrEmpty(AdultPnr) || AdultPnr.Trim().Length != 6) { AdultPnr = ""; } //记录编码日志 YuDingPnrLog(pnrObj, pnrObj.AdultYudingList.Keys[0], pnrObj.AdultYudingList.Values[0], AdultPnr, pnrObj.Office, out logAdultPnr); } if (!string.IsNullOrEmpty(pnrObj.AdultPnr)) { //取消编码 if (SendManage.CancelPnr(pnrObj.AdultPnr, pnrObj.Office)) { if (logAdultPnr != null) { //修改状态 logAdultPnr.Flag = true; string tempSql = PbProject.Dal.Mapping.MappingHelper <Log_Pnr> .CreateUpdateModelSql(logAdultPnr, "id"); Manage.ExecuteNonQuerySQLInfo(tempSql); } } } //获取价格 if (pnrObj.PatModelList != null && pnrObj.PatModelList.Length > 0) { Pat = pnrObj.PatModelList[0]; if (Pat != null && Pat.UninuePatList.Count > 0) { strValue[0] = Pat.UninuePatList[0].Fare; //舱位价 strValue[1] = Pat.UninuePatList[0].TAX; //基建 strValue[2] = Pat.UninuePatList[0].RQFare; //燃油 strValue[3] = Pat.UninuePatList[0].Price; //总计(舱位价+基建+燃油) decimal.TryParse(strValue[0], out spFare); decimal.TryParse(strValue[1], out spABFare); decimal.TryParse(strValue[2], out spRQFare); } } } //--------------------------------------------------------------- } if (spFare != 0m) { //存入缓存 SpBll.SaveSpPrice(aircode.ToUpper(), aircono, DateTime.Parse(starttime + " " + totime + ":00"), fromcity, tocity, cw, spFare, spABFare, spRQFare); } } else { strValue[0] = PriceInfo.SpPrice.ToString(); //舱位价 strValue[1] = PriceInfo.SpABFare.ToString(); //基建 strValue[2] = PriceInfo.SpRQFare.ToString(); //燃油 strValue[3] = (PriceInfo.SpPrice + PriceInfo.SpABFare + PriceInfo.SpRQFare).ToString(); } } #endregion } else { strValue[0] = Fare; //舱位价 strValue[1] = TAX; //基建 strValue[2] = RQFare; //燃油 strValue[3] = (decimal.Parse(Fare) + decimal.Parse(TAX) + decimal.Parse(RQFare)).ToString(); } //实付金额 string sjvalue = new PbProject.Logic.Pay.Data(userInfo.Company.UninCode).CreatePassengerPayFee(decimal.Parse(strValue[0]), decimal.Parse(strValue[1]), decimal.Parse(strValue[2]), decimal.Parse(fd), decimal.Parse(strYh), 1).ToString(); string pyj = new PbProject.Logic.Pay.Data(userInfo.Company.UninCode).CreateCommissionCG(decimal.Parse(strValue[0]), decimal.Parse(fd)).ToString(); string ZK = ""; if (Yprice != "0")//如果传的有Y舱价格,则是特价类型的,则计算折扣 { PbProject.Logic.Pay.DataAction plpd = new PbProject.Logic.Pay.DataAction(); //特价时候需要计算折扣,让前台计算加入哪一个折扣范围 decimal tempFare = 0; decimal.TryParse(strValue[0], out tempFare); decimal tempYprice = 0; decimal.TryParse(Yprice, out tempYprice); //计算特价的折扣 ZK = (new PbProject.Logic.Pay.DataAction().FourToFiveNum((tempFare / tempYprice), 4) * 100).ToString("f2"); decimal tempZK = 0; decimal.TryParse(ZK, out tempZK); ZK = plpd.FourToFiveNum(tempZK, 0).ToString(); } if (strValue[0] != "" || strValue[1] != "" || strValue[2] != "" || strValue[3] != "") { decimal tempPrice = 0; decimal.TryParse(strValue[0], out tempPrice); #region pat 有数据 sp.SpacePrice = tempPrice.ToString("f0"); sp.Tax = strValue[1]; sp.RQFare = strValue[2]; sp.TotalPrice = strValue[3]; sp.RealPayPrice = sjvalue; sp.Commission = pyj; sp.GUID = hidId; sp.Discount = ZK; #endregion } else { #region pat 没有数据 #endregion pat 出来没有数据 } //最终sb格式 0舱位价@1基建@2燃油@3总计(舱位价+基建+燃油)@4实付金额@5佣金@6guid@7特价计算的折扣 return(sp); //Response.Write(""); } catch (Exception ex) { return(sp); } }