Пример #1
0
    /// <summary>
    /// 显示绑定数据
    /// </summary>
    /// <param name="Param"></param>
    public void ShowData(PnrImportParam Param)
    {
        //初始化页面需要操作的航段和乘机人实体信息
        Hid_SkyModel.Value = escape(JsonHelper.ObjToJson <Tb_Ticket_SkyWay>(Param.OrderParam.OrderParamModel[0].SkyList[0]));
        Hid_PasModel.Value = escape(JsonHelper.ObjToJson <Tb_Ticket_Passenger>(Param.OrderParam.OrderParamModel[0].PasList[0]));
        //编码信息
        Hid_ALLInfo.Value = Escape(JsonHelper.ObjToJson <PnrImportParam>(Param));

        //显示数据
        lblCustomer.Text    = Param.m_UserInfo.LoginName + "-" + Param.m_CurCompany.UninAllName;
        lblCpyNo.Text       = Param.m_CurCompany.UninCode;
        Hid_OrderType.Value = Param.OrderParam.OrderParamModel[0].Order.IsChdFlag ? "1" : "0";
        if (PasAndCardTypeList.Count == 0)
        {
            string sqlWhere = " parentid in(1,6,7,33) order by ChildID";
            PasAndCardTypeList = this.baseDataManage.CallMethod("Bd_Base_Dictionary", "GetList", null, new object[] { sqlWhere }) as List <Bd_Base_Dictionary>;
        }
        if (CityList.Count == 0)
        {
            CityList = this.baseDataManage.CallMethod("Bd_Air_AirPort", "GetList", null, new object[] { "IsDomestic=1" }) as List <Bd_Air_AirPort>;
        }
        //绑定状态
        BindData();
        //绑定城市
        BindCity();

        txtBirday_0.Value = System.DateTime.Now.ToString("yyyy-MM-dd");
    }
Пример #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         this.currentuserid.Value = this.mUser.id.ToString();
     }
     if (Request["create"] != null && Request["create"].ToString() == "1")
     {
         Create_Click();
     }
     else
     {
         if (!IsPostBack)
         {
             if (Context.Handler is IObject)
             {
                 PnrImportParam pageobj = (PnrImportParam)(Context.Handler as IObject).PageObj;
                 if (pageobj != null && pageobj.OrderParam.OrderParamModel.Count > 0)
                 {
                     // ViewState["param"] = pageobj;
                     ShowData(pageobj);
                 }
                 else
                 {
                     //if (ViewState["param"] != null)
                     //{
                     //    pageobj = ViewState["param"] as PnrImportParam;
                     //    ShowData(pageobj);
                     //}
                     //else
                     //{
                     ScriptManager.RegisterStartupScript(this, GetType(), Guid.NewGuid().ToString(), "showdialog('传入对象为空!');", true);
                     //}
                 }
             }
             else
             {
                 ScriptManager.RegisterStartupScript(this, GetType(), Guid.NewGuid().ToString(), "showdialog('对象为空!');", true);
             }
         }
     }
 }
Пример #3
0
    //生成订单
    public void Create_Click()
    {
        string Msg    = "";
        bool   IsSuc  = false;
        string ErrMsg = "";

        try
        {
            if (mCompany == null)
            {
                Msg = "0##订单生成成失败!原因如下<br />页面已过期,请刷新页面或者重新登录!##";
            }
            else
            {
                //订单管理
                Tb_Ticket_OrderBLL OrderManage = new Tb_Ticket_OrderBLL();
                string             data        = Request["data"].ToString();
                PnrImportParam     PImport     = JsonHelper.JsonToObj <PnrImportParam>(data);
                if (PImport != null)
                {
                    OrderMustParamModel item = PImport.OrderParam.OrderParamModel[0];

                    //航段---------------------------------------------------------
                    List <string> CarryCodeList  = new List <string>();
                    List <string> FlightCodeList = new List <string>();
                    List <string> TravelList     = new List <string>();
                    List <string> AirTimeList    = new List <string>();
                    List <string> TravelCodeList = new List <string>();
                    List <string> SpaceList      = new List <string>();
                    List <string> DisCountList   = new List <string>();
                    for (int i = 0; i < item.SkyList.Count; i++)
                    {
                        CarryCodeList.Add(item.SkyList[i].CarryCode);
                        FlightCodeList.Add(item.SkyList[i].FlightCode);
                        AirTimeList.Add(item.SkyList[i].FromDate.ToString("yyyy-MM-dd HH:mm"));
                        TravelList.Add(item.SkyList[i].FromCityName + "-" + item.SkyList[i].ToCityName);
                        TravelCodeList.Add(item.SkyList[i].FromCityCode + "-" + item.SkyList[i].ToCityCode);
                        SpaceList.Add(item.SkyList[i].Space);
                        DisCountList.Add(item.SkyList[i].Discount);
                    }
                    item.Order.CarryCode  = string.Join("/", CarryCodeList.ToArray());
                    item.Order.FlightCode = string.Join("/", FlightCodeList.ToArray());
                    item.Order.AirTime    = DateTime.Parse(AirTimeList[0]);
                    item.Order.Travel     = string.Join("/", TravelList.ToArray());
                    item.Order.TravelCode = string.Join("/", TravelCodeList.ToArray());
                    item.Order.Space      = string.Join("/", SpaceList.ToArray());
                    item.Order.Discount   = string.Join("/", DisCountList.ToArray());
                    //------------------------------------------------------------------------------------
                    //备注
                    item.Order.YDRemark = HttpUtility.UrlDecode(Request["Remark"].ToString(), Encoding.Default);//txtRemark.Value.Trim();//订单生成备注
                    //订单中的总价
                    decimal TotalPMPrice = 0m, TotalABFare = 0, TotalRQFare = 0m;
                    decimal PolicyMoney = 0m;                         //订单佣金
                    Data    d           = new Data(this.mUser.CpyNo); //采购佣金进舍规则: 0.舍去佣金保留到元、1.舍去佣金保留到角、2.舍去佣金保留到分

                    //乘客人数
                    item.Order.PassengerNumber = item.PasList.Count;
                    //乘客姓名 已"|"分割
                    List <string> PasNameList = new List <string>();
                    //乘机人实体处理
                    for (int j = 0; j < item.PasList.Count; j++)
                    {
                        //订单价格
                        TotalPMPrice += item.PasList[j].PMFee;
                        TotalABFare  += item.PasList[j].ABFee;
                        TotalRQFare  += item.PasList[j].FuelFee;
                        if (item.PasList[j].PassengerType == 1 || item.PasList[j].PassengerType == 2)
                        {
                            PolicyMoney = d.CreateCommissionCG(item.PasList[j].PMFee, item.Order.PolicyPoint);
                        }
                        //订单中的乘客显示
                        PasNameList.Add(item.PasList[j].PassengerName);
                    }
                    //乘客姓名
                    item.Order.PassengerName = string.Join("|", PasNameList.ToArray());

                    //订单赋值
                    item.Order.PMFee   = TotalPMPrice;
                    item.Order.ABFee   = TotalABFare;
                    item.Order.FuelFee = TotalRQFare;
                    //政策返点
                    item.Order.PolicyPoint = item.Order.PolicyPoint;
                    //最终返点
                    item.Order.ReturnPoint = item.Order.ReturnPoint;
                    //原始政策返点
                    item.Order.OldPolicyPoint = item.Order.PolicyPoint;
                    if (mCompany.RoleType == 1)
                    {
                        //出票公司编号
                        item.Order.CPCpyNo = string.IsNullOrEmpty(PImport.m_SupCompany.UninCode) ? PImport.m_SupCompany.UninCode : "";
                    }
                    else
                    {
                        //出票公司编号
                        item.Order.CPCpyNo = mCompany.UninCode;
                    }
                    //出票公司编号
                    item.Order.CPCpyNo = item.Order.CPCpyNo.Length > 12 ? item.Order.CPCpyNo.Substring(0, 12) : item.Order.CPCpyNo;
                    //item.Order.PayMoney = d.CreateOrderPayMoney(item.Order, item.PasList);//计算订单金额
                    //item.Order.OrderMoney = d.CreateOrderOrderMoney(item.Order, item.PasList);
                    Bill bill = new Bill();
                    bill.CreateOrderAndTicketPayDetailNew(item.Order, item.PasList);

                    //佣金
                    item.Order.PolicyMoney = PolicyMoney;
                    item.Order.A1          = 1;//已确认

                    //开启添加订单账单明细sql
                    PImport.OrderParam.IsCreatePayDetail = 1;
                    //判断金额是否正确
                    if (item.Order.PayMoney <= 0 || item.Order.OrderMoney <= 0 || ((item.Order.PayMoney + item.Order.PayMoney * 0.003M) < item.Order.OrderMoney))
                    {
                        Msg = "0##订单生成成失败!原因如下<br />订单金额有误##";
                    }
                    else
                    {
                        //生成订单
                        IsSuc = OrderManage.CreateOrder(ref PImport.OrderParam, out ErrMsg);
                        if (IsSuc)
                        {
                            Msg = "1##订单生成成功!##" + "订单号:" + PImport.OrderParam.OrderParamModel[0].Order.OrderId;
                        }
                        else
                        {
                            Msg = "0##订单生成成失败!原因如下<br />" + ErrMsg + "##";
                        }
                    }
                }
            }
        }
        catch (Exception ex)
        {
            Msg = "0##页面异常!原因如下<br />" + ex.Message + "##";
            //DataBase.LogCommon.Log.Error("HandPnrImport.aspx:" + ErrMsg, ex);
            PnrAnalysis.LogText.LogWrite("HandPnrImport.aspx:" + ErrMsg + "|" + ex.Message, "HandPnrImport");
        }
        finally
        {
            PnrAnalysis.LogText.LogWrite("HandPnrImport.aspx:" + Msg + "\r\n", "HandPnrImport");
            OutPut(Msg);
        }
    }
Пример #4
0
    /// <summary>
    /// 1PNR内容导入 0PNR导入 2pnr入库记账
    /// </summary>
    /// <param name="type"></param>
    public void Import(int type)
    {
        bool IsResponse = false;

        try
        {
            string strKongZhiXiTong = "", strGongYingKongZhiFenXiao = "";
            PbProject.Model.ConfigParam    configParam = null;
            PbProject.Model.User_Company   msupCompany = null;
            PbProject.Model.User_Company   mcompany = null;
            PbProject.Model.User_Employees muser = null;
            string strGY = Hid_GY.Value;
            string strKH = Hid_KH.Value;
            if (mCompany.RoleType == 1)
            {
                //平台
                if (!string.IsNullOrEmpty(strGY))
                {
                    //UninCode-LoginName-UninAllName-uid-cid
                    string[] strArr = strGY.Split('@');
                    msupCompany = this.baseDataManage.CallMethod("User_Company", "GetById", null, new object[] { strArr[4] }) as User_Company;
                    if (msupCompany != null)
                    {
                        List <Bd_Base_Parameters> GYParameters = baseDataManage.CallMethod("Bd_Base_Parameters", "GetList", null, new Object[] { "CpyNo='" + msupCompany.UninCode + "'" }) as List <Bd_Base_Parameters>;
                        if (GYParameters != null)
                        {
                            strKongZhiXiTong          = BaseParams.getParams(GYParameters).KongZhiXiTong;
                            strGongYingKongZhiFenXiao = BaseParams.getParams(GYParameters).GongYingKongZhiFenXiao;
                            configParam = Bd_Base_ParametersBLL.GetConfigParam(GYParameters);
                        }
                    }
                }
            }
            else
            {
                //供应
                strKongZhiXiTong          = BaseParams.getParams(supBaseParametersList).KongZhiXiTong;
                strGongYingKongZhiFenXiao = BaseParams.getParams(baseParametersList).GongYingKongZhiFenXiao;
                configParam = this.configparam;
                msupCompany = this.mSupCompany;
            }
            //选择客户
            if (!string.IsNullOrEmpty(strKH))
            {
                //UninCode-LoginName-UninAllName-uid-cid
                string[] strArr = strKH.Split('@');
                if (strArr.Length == 5)
                {
                    muser = this.baseDataManage.CallMethod("User_Employees", "GetById", null, new object[] { strArr[3] }) as User_Employees;
                    List <User_Company> uCompanyList = baseDataManage.CallMethod("User_Company", "GetList", null, new Object[] { "UninCode='" + muser.CpyNo + "'" }) as List <User_Company>;

                    if (uCompanyList != null && uCompanyList.Count > 0)
                    {
                        mcompany = uCompanyList[0];
                    }
                }
            }
            PnrImportParam Param = new PnrImportParam();
            Param.m_UserInfo     = muser;
            Param.m_CurCompany   = mcompany;
            Param.m_SupCompany   = msupCompany;
            Param.m_LoginUser    = mUser;
            Param.m_LoginCompany = mCompany;
            PnrImportManage Mange = new PnrImportManage(muser, mcompany, msupCompany, strKongZhiXiTong, strGongYingKongZhiFenXiao, configParam);
            //是否生成订单 否
            Param.IsCreateOrder = false;
            Param.Source        = 1;//后台
            Param.RoleType      = mCompany.RoleType.ToString();
            Param.OrderId       = Hid_OrderId.Value;
            if (type == 0 || type == 2)
            {
                //是否PNR入库记账
                Param.IsImportJZ = type == 2 ? 1 : 0;
                //Pnr导入 或者PNR入库记账
                Param.Pnr = (type == 2) ? txtH_PNR3.Value.Trim() : txtH_PNR.Value.Trim();
                if (Hid_IsBigCode.Value == "1")
                {
                    Param.ImportTongDao = 3;
                    Param.BigPnr        = txtH_PNR.Value.Trim();
                }
            }
            else if (type == 1)
            {
                //Pnr内容导入
                Param.ImportTongDao = 4;
                //关闭PNR导入合并
                if (KongZhiXiTong != null && KongZhiXiTong.Contains("|59|"))
                {
                    Param.IsMerge = 0;//未合并
                    Param.RTData  = pnrCon.Value.Trim().Replace("'", "");
                    Param.PATData = patCon.Value.Trim().Replace("'", "");
                }
                else
                {
                    Param.IsMerge      = 1;//合并
                    Param.RTAndPatData = txtPNRAndPata.Text.Trim().Replace("'", "");
                }
            }
            bool IsSuc = Mange.GetImportPnrInfo(Param);
            if (!IsSuc)
            {
                #region 出错提示

                Hid_OrderId.Value      = "";
                Param.SecondPM.ErrCode = "0";
                if (Param.IsNextOK == 1)
                {
                    //继续操作
                    Param.SecondPM.OpType = "1";
                }
                else
                {
                    Param.SecondPM.Msg = Param.TipMsg;
                    //提示
                    Param.SecondPM.OpType = "0";
                }
                string result = JsonHelper.ObjToJson <PnrImportParam>(Param);
                ScriptManager.RegisterStartupScript(this, GetType(), Guid.NewGuid().ToString(), "showMsg('" + escape(Param.SecondPM.Msg) + "',{t:2,type:" + type + ",code:\"" + escape(result) + "\"});ShowDiv(false);", true);

                #endregion
            }
            else
            {
                //页面间传递数据对象
                ////成功显示数据
                //ViewState["Param"] = Param;
                //将数据传入到指定页面处理
                this.PageObj = Param;
                //方案一
                //Server.Transfer("HandPnrImport.aspx", true);
                //Response.Redirect("HandPnrImport.aspx", false);
                //方案二
                System.IO.StringWriter sw = new System.IO.StringWriter();
                Server.Execute("HandPnrImport.aspx?currentuserid=" + this.currentuserid.Value, sw);
                IsResponse = true;
                Response.Clear();
                Response.Write(sw.ToString());
                Response.End();
            }
        }
        catch (Exception ex)
        {
            if (!IsResponse)
            {
                ScriptManager.RegisterStartupScript(this, GetType(), Guid.NewGuid().ToString(), "showMsg('页面异常!');ShowDiv(false);", true);
            }
        }
    }