コード例 #1
0
        /// <summary>
        /// 保存操作
        /// </summary>
        /// <returns></returns>
        private string Save()
        {
            string msg = string.Empty;

            EyouSoft.Model.TourStructure.MTourOrderExpand order             = new EyouSoft.Model.TourStructure.MTourOrderExpand();
            IList <EyouSoft.Model.TourStructure.MTourOrderCarTypeSeat> list = null;

            if (PageValidate(ref order, ref msg))
            {
                //判断客户单位是否欠款、单团账龄是否超限
                EyouSoft.BLL.TourStructure.BQuote            bll = new EyouSoft.BLL.TourStructure.BQuote();
                EyouSoft.Model.FinStructure.MCustomerWarning customerWarningModel = bll.GetCustomerOverrunDetail(SiteUserInfo.TourCompanyInfo.CompanyId, order.SumPrice, SiteUserInfo.CompanyId);

                if (customerWarningModel != null)
                {
                    msg = UtilsCommons.AjaxReturnJson("0", "您的欠款已经超过限额,暂不可报名。");
                }
                else
                {
                    EyouSoft.BLL.TourStructure.BTourOrder bOrder = new EyouSoft.BLL.TourStructure.BTourOrder();
                    string IsShortRoute = Utils.GetQueryStringValue("IsShort");
                    int    flg          = 0;
                    if (!string.IsNullOrEmpty(IsShortRoute))
                    {
                        flg = bOrder.AddTourOrderExpand(order, ref list);
                    }
                    else
                    {
                        flg = bOrder.AddTourOrderExpand(order);
                    }
                    if (flg == 3)
                    {
                        msg = UtilsCommons.AjaxReturnJson("1", "订单报名成功! 正在跳转...");
                    }
                    else if (flg == 5)
                    {
                        msg = UtilsCommons.AjaxReturnJson("0", "计划自动客满,不允许报名!");
                    }
                    else if (flg == 6)
                    {
                        msg = UtilsCommons.AjaxReturnJson("0", "计划自动停收,不允许报名!");
                    }
                    else if (flg == 7)
                    {
                        msg = UtilsCommons.AjaxReturnJson("0", "计划手动客满,不允许报名!");
                    }
                    else if (flg == 8)
                    {
                        msg = UtilsCommons.AjaxReturnJson("0", "计划手动停收,不允许报名!");
                    }
                    else if (flg == 1)
                    {
                        msg = UtilsCommons.AjaxReturnJson("0", "订单报名人数超过计划剩余人数!");
                    }
                    else
                    {
                        msg = UtilsCommons.AjaxReturnJson("0", "订单报名失败!");
                    }
                }
            }
            else
            {
                msg = UtilsCommons.AjaxReturnJson("0", msg);
            }

            return(msg);
        }
コード例 #2
0
        /// <summary>
        /// 保存按钮点击事件执行方法
        /// </summary>
        protected string PageSave()
        {
            string msg = "";

            #region 获得参数
            string doType   = Utils.GetQueryStringValue("doType");
            string saveType = Utils.GetQueryStringValue("saveType");
            string tourID   = Utils.GetQueryStringValue("tourID");
            string orderID  = Utils.GetQueryStringValue("orderID");
            #endregion

            #region 获得表单
            //联系人
            string contactName = Utils.GetFormValue(this.txtContact.UniqueID);
            string contactTel  = Utils.GetFormValue(this.txtContactTel.UniqueID);
            //联系人部门编号
            string contactDepartId = Utils.GetFormValue(this.hideContactDeptId.UniqueID);
            //销售员
            string sellsID   = Utils.GetFormValue(this.SellsSelect1.SellsIDClient);
            string sellsName = Utils.GetFormValue(this.SellsSelect1.SellsNameClient);
            //客户单位
            string companyID   = Utils.GetFormValue(this.CustomerUnitSelect1.ClientNameKHBH);
            string companyName = Utils.GetFormValue(this.CustomerUnitSelect1.ClientNameKHMC);
            #region 团队计划价格组成
            //成人单价
            decimal adultPrice = Utils.GetDecimal(Utils.GetFormValue(this.hideAdultPrice.UniqueID));
            //成人数
            int adultCount = Utils.GetInt(Utils.GetFormValue(this.txtAdultCount.UniqueID));
            //儿童单价
            decimal childPrice = Utils.GetDecimal(Utils.GetFormValue(this.hideChildPrcie.UniqueID));
            //儿童数量
            int childCount = Utils.GetInt(Utils.GetFormValue(this.txtChildCount.UniqueID));
            #endregion
            //增加费用
            decimal addPrice = Utils.GetDecimal(Utils.GetFormValue(this.txtAddPrice.UniqueID));
            //增加费用备注
            string remarksFrist = Utils.GetFormValue(this.txtRemarksFrist.UniqueID);
            //减少费用
            decimal reducePrice = Utils.GetDecimal(Utils.GetFormValue(this.txtReducePrice.UniqueID));
            //减少费用备注
            string remarksSecond = Utils.GetFormValue(this.txtRemarksSecond.UniqueID);
            //导游现收
            decimal guidePrice = Utils.GetDecimal(Utils.GetFormValue(this.txtGuidePrice.UniqueID));
            //合计金额
            decimal totalPrice = Utils.GetDecimal(Utils.GetFormValue(this.txtTotalPrice.UniqueID));
            //销售应收
            decimal sellPrice = totalPrice - guidePrice;
            //订单备注
            string orderRemarks = Utils.GetFormValue(this.txtRemarksOrder.UniqueID);
            //合同号
            string contractCode   = Utils.GetFormValue(txtHeTongHao.HeTongCodeClientID);
            string contractCodeId = Utils.GetFormValue(txtHeTongHao.HeTongIdClientID);
            //客源地 国家
            int countryID = Utils.GetInt(Utils.GetFormValue("sltCountry"));
            //客源地 省份
            int provinceID = Utils.GetInt(Utils.GetFormValue("sltProvince"));
            //预留截至时间
            DateTime?saveSeatDate = Utils.GetDateTimeNullable(Utils.GetFormValue(this.txtSaveSeatDate.UniqueID));
            //团类型
            EyouSoft.Model.EnumType.TourStructure.TourType tourType = (EyouSoft.Model.EnumType.TourStructure.TourType)Utils.GetInt(Utils.GetFormValue(this.hideTourType.UniqueID));
            //订单来源
            EyouSoft.Model.EnumType.TourStructure.OrderType orderType = (EyouSoft.Model.EnumType.TourStructure.OrderType)Utils.GetInt(Utils.GetFormValue(this.hideOrderFrom.UniqueID));
            #endregion

            #region 表单验证

            if (contactName == "")
            {
                msg = "请输入联系人!<br />";
            }
            if (sellsID == "" || sellsName == "")
            {
                msg += "请选择销售员!<br />";
            }
            if (adultPrice <= 0)
            {
                msg += "请输入成人单价!<br />";
            }
            if (adultCount <= 0)
            {
                msg += "请输入成人数!<br />";
            }
            if (saveType == "1" && saveSeatDate == null)
            {
                msg += "请选择预留日期!<br />";
            }
            if (saveType == "1" && saveSeatDate != null)
            {
                GetMaxDateTime();
                if (saveSeatDate > Utils.GetDateTime(MaxDateTime) || saveSeatDate < DateTime.Now.AddMinutes(5))
                {
                    msg += "请选择新的预留日期!<br />";
                }
            }


            if (msg != "")
            {
                return(UtilsCommons.AjaxReturnJson("0", msg));
            }

            #endregion

            EyouSoft.BLL.TourStructure.BTourOrder         orderBll   = new EyouSoft.BLL.TourStructure.BTourOrder();
            EyouSoft.Model.TourStructure.MTourOrderExpand orderModel = new EyouSoft.Model.TourStructure.MTourOrderExpand();

            orderModel.BuyCompanyId    = companyID;
            orderModel.BuyCompanyName  = companyName;
            orderModel.ContactName     = contactName;
            orderModel.ContactTel      = contactTel;
            orderModel.ContactDepartId = contactDepartId;
            orderModel.SellerId        = sellsID;
            orderModel.SellerName      = sellsName;
            orderModel.OperatorId      = SiteUserInfo.UserId;
            orderModel.Operator        = SiteUserInfo.Name;
            orderModel.Adults          = adultCount;
            orderModel.Childs          = childCount;
            orderModel.PriceStandId    = Utils.GetInt(Utils.GetFormValue(this.hidePriceStandID.UniqueID));
            orderModel.BuyCountryId    = countryID;
            orderModel.BuyProvincesId  = provinceID;
            orderModel.SettlementMoney = adultPrice * adultCount + childCount * childPrice;
            #region 销售价
            orderModel.LevId      = Utils.GetInt(Utils.GetFormValue(this.hideLevelID.UniqueID));
            orderModel.AdultPrice = Utils.GetDecimal(Utils.GetFormValue(this.hideAdultPrice.UniqueID));
            orderModel.ChildPrice = Utils.GetDecimal(Utils.GetFormValue(this.hideChildPrcie.UniqueID));
            #endregion

            #region 结算价
            orderModel.PeerAdultPrice = Utils.GetDecimal(Utils.GetFormValue(this.hideSettAdultPrice.UniqueID));
            orderModel.PeerChildPrice = Utils.GetDecimal(Utils.GetFormValue(this.hideSettChildPrice.UniqueID));
            orderModel.PeerLevId      = Utils.GetInt(Utils.GetFormValue(this.hideSettLevelID.UniqueID));
            #endregion


            orderModel.ContractCode         = contractCode;
            orderModel.ContractId           = contractCodeId;
            orderModel.OrderRemark          = orderRemarks;
            orderModel.SaleAddCost          = addPrice;
            orderModel.SaleAddCostRemark    = remarksFrist;
            orderModel.SaleReduceCost       = reducePrice;
            orderModel.SaleReduceCostRemark = remarksSecond;
            orderModel.SalerIncome          = sellPrice;
            orderModel.GuideIncome          = guidePrice;
            orderModel.SumPrice             = totalPrice;
            orderModel.CompanyId            = SiteUserInfo.CompanyId;
            orderModel.DeptId = Utils.GetInt(Utils.GetFormValue(this.hideDeptID.UniqueID));
            orderModel.TourId = tourID;
            switch (tourType)
            {
            case EyouSoft.Model.EnumType.TourStructure.TourType.出境散拼:
            case EyouSoft.Model.EnumType.TourStructure.TourType.出境团队: orderModel.MTourOrderTravellerList = UtilsCommons.GetTravelListS(); break;

            case EyouSoft.Model.EnumType.TourStructure.TourType.组团散拼:
            case EyouSoft.Model.EnumType.TourStructure.TourType.地接散拼:
            case EyouSoft.Model.EnumType.TourStructure.TourType.地接团队:
            case EyouSoft.Model.EnumType.TourStructure.TourType.组团团队: orderModel.MTourOrderTravellerList = UtilsCommons.GetTravelList(); break;
            }
            int result = 0;

            //散拼订单新增

            orderModel.TourType   = tourType;
            orderModel.IssueTime  = DateTime.Now;
            orderModel.NeiBuXinXi = Utils.GetFormValue(txtNeiBuXinXi.UniqueID);

            #region 变更实体
            EyouSoft.Model.TourStructure.MTourOrderChange changeModel = new EyouSoft.Model.TourStructure.MTourOrderChange();
            changeModel.CompanyId    = orderModel.CompanyId;
            changeModel.TourId       = orderModel.TourId;
            changeModel.ChangePerson = adultCount + childCount;
            changeModel.ChangePrice  = totalPrice;
            changeModel.CompanyId    = SiteUserInfo.CompanyId;
            if (Utils.GetFormValue(this.hideOldAdultCount.UniqueID).Split('|').Length == 2)
            {
                int oldAdultCount = Utils.GetInt(Utils.GetFormValue(this.hideOldAdultCount.UniqueID).Split('|')[0]);
                int oldChildCount = Utils.GetInt(Utils.GetFormValue(this.hideOldAdultCount.UniqueID).Split('|')[1]);

                //changeModel.Content = "成人数由" + adultCount + "变" + oldAdultCount;
                changeModel.Content = "成人数由" + oldAdultCount + "变" + adultCount;

                //changeModel.Content += " 儿童数由" + childCount + "变" + oldChildCount;
                changeModel.Content += " 儿童数由" + oldChildCount + "变" + childCount;
            }
            changeModel.IssueTime  = DateTime.Now;
            changeModel.IsSure     = false;
            changeModel.Operator   = SiteUserInfo.Name;
            changeModel.OperatorId = SiteUserInfo.UserId;
            changeModel.OrderId    = orderID;
            changeModel.ChangeType = EyouSoft.Model.EnumType.TourStructure.ChangeType.修改;
            if (Utils.GetFormValue(this.hideOrderBianGeng.UniqueID) == "true")
            {
                changeModel.ChangeType = EyouSoft.Model.EnumType.TourStructure.ChangeType.变更;
            }

            #endregion

            switch (saveType)
            {
            //确认预留
            case "1":
                orderModel.OrderStatus     = EyouSoft.Model.EnumType.TourStructure.OrderStatus.已留位;
                orderModel.SaveSeatDate    = saveSeatDate;
                orderModel.TourOrderChange = changeModel;
                break;

            //确定成交
            case "2":
                orderModel.OrderStatus     = EyouSoft.Model.EnumType.TourStructure.OrderStatus.已成交;
                orderModel.SaveSeatDate    = null;
                orderModel.TourOrderChange = changeModel;
                break;

            case "4":
                orderModel.OrderStatus     = (EyouSoft.Model.EnumType.TourStructure.OrderStatus)Utils.GetInt(Utils.GetFormValue(this.hideOrderState.UniqueID));
                orderModel.SaveSeatDate    = saveSeatDate;
                orderModel.TourOrderChange = changeModel;
                break;

            //取消订单
            case "5":
                int bllRetCode1 = 0;
                bllRetCode1 = orderBll.UpdateTourOrderExpand(orderID, EyouSoft.Model.EnumType.TourStructure.OrderStatus.已取消, null);

                if (bllRetCode1 == 1)
                {
                    return(UtilsCommons.AjaxReturnJson("1", "操作成功"));
                }
                else if (bllRetCode1 == -99)
                {
                    return(UtilsCommons.AjaxReturnJson("0", "不存在的订单信息"));
                }
                else if (bllRetCode1 == -98)
                {
                    return(UtilsCommons.AjaxReturnJson("0", "已取消的订单不可重复取消订单"));
                }
                else if (bllRetCode1 == -97)
                {
                    return(UtilsCommons.AjaxReturnJson("0", "该计划状态不允许取消订单"));
                }
                else if (bllRetCode1 == -96)
                {
                    return(UtilsCommons.AjaxReturnJson("0", "已确认合同金额不允许取消订单"));
                }
                else if (bllRetCode1 == -95)
                {
                    return(UtilsCommons.AjaxReturnJson("0", "已存在收款信息不允许取消订单"));
                }
                else
                {
                    return(UtilsCommons.AjaxReturnJson("0", "操作失败"));
                }

            //不受理
            case "6":
                int bllRetCode2 = 0;
                bllRetCode2 = orderBll.UpdateTourOrderExpand(orderID, EyouSoft.Model.EnumType.TourStructure.OrderStatus.受理, null);

                if (bllRetCode2 == 1)
                {
                    return(UtilsCommons.AjaxReturnJson("1", "操作成功"));
                }
                else if (bllRetCode2 == -99)
                {
                    return(UtilsCommons.AjaxReturnJson("0", "不存在的订单信息"));
                }
                else if (bllRetCode2 == -98)
                {
                    return(UtilsCommons.AjaxReturnJson("0", "已取消的订单不可重复取消订单"));
                }
                else if (bllRetCode2 == -97)
                {
                    return(UtilsCommons.AjaxReturnJson("0", "该计划状态不允许取消订单"));
                }
                else if (bllRetCode2 == -96)
                {
                    return(UtilsCommons.AjaxReturnJson("0", "已确认合同金额不允许取消订单"));
                }
                else if (bllRetCode2 == -95)
                {
                    return(UtilsCommons.AjaxReturnJson("0", "已存在收款信息不允许取消订单"));
                }
                else
                {
                    return(UtilsCommons.AjaxReturnJson("0", "操作失败"));
                }
            }



            #region 新增订单
            if (tourID != "" && orderID == "")
            {
                orderModel.OrderId   = Guid.NewGuid().ToString();
                orderModel.OrderType = EyouSoft.Model.EnumType.TourStructure.OrderType.代客预定;
                result = orderBll.AddTourOrderExpand(orderModel);
            }
            #endregion

            #region 修改订单
            if (orderID != "")
            {
                //如果计划是供应商 发布的,且不超限 那么订单状态永远是未处理
                if (Utils.GetFormValue(this.hideSourceID.UniqueID).Trim() != "")
                {
                    orderModel.OrderStatus = EyouSoft.Model.EnumType.TourStructure.OrderStatus.未处理;
                }
                orderModel.OrderId   = orderID;
                orderModel.OrderType = orderType;
                result = orderBll.UpdateTourOrderExpand(orderModel);
            }

            switch (result)
            {
            case 1:
                msg = UtilsCommons.AjaxReturnJson("0", "报名失败,总人数超过计划剩余人数!");
                break;

            case 2:
                msg = UtilsCommons.AjaxReturnJson("0", "报名失败,合同号未领用!");
                break;

            case 3:
                if (saveType == "1")
                {
                    msg = UtilsCommons.AjaxReturnJson("1", "预留成功,正在跳转..");
                }
                if (saveType == "2")
                {
                    msg = UtilsCommons.AjaxReturnJson("1", "确认成功!");
                }
                if (saveType == "3")
                {
                    msg = UtilsCommons.AjaxReturnJson("1", "垫付申请成功!");
                }
                if (saveType == "4")
                {
                    msg = UtilsCommons.AjaxReturnJson("1", "操作成功!");
                }
                break;

            case 4:
                msg = UtilsCommons.AjaxReturnJson("0", "报名失败,未知错误!");
                break;

            case 5:
            case 9:
                msg = UtilsCommons.AjaxReturnJson("2", "操作成功! 销售员已超限,请收款或超限申请!", orderModel.OrderId);
                break;

            case 6:
            case 10:
                msg = UtilsCommons.AjaxReturnJson("2", "操作成功! 客户单位已超限,请收款或超限申请!", orderModel.OrderId);
                break;

            case 7:
            case 11:
                msg = UtilsCommons.AjaxReturnJson("2", "操作成功! 销售员和客户单位已超限,请收款或超限申请!", orderModel.OrderId);
                break;
            }
            #endregion
            return(msg);
        }