Ejemplo n.º 1
0
        /// <summary>
        /// 作废订单操作
        /// </summary>
        /// <param name="context">上下文对象</param>
        public void DeleteOrders(HttpContext context)
        {
            BLL.Order bll      = new BLL.Order();
            int       orderId  = ZJRequest.GetFormInt("orderId");
            string    username = context.User.Identity.Name;

            Common.SysUserEntity model = new BLL.sysUser().GetSysUserByLoginName(username);
            bll.Delete(model.Name, orderId);
        }
Ejemplo n.º 2
0
        public void SaveData(HttpContext context)
        {
            bool     isConfirmData               = bool.Parse(ZJRequest.GetFormString("isConfirmData"));
            string   opType                      = ZJRequest.GetFormString("info[opType]");
            string   BuyWay                      = ZJRequest.GetFormString("info[BuyWay]");
            string   orderNo                     = ZJRequest.GetFormString("info[OrderNo]");
            DateTime CreateTime                  = Convert.ToDateTime(context.Request.Form["info[CreateTime]"]);
            string   PurchaseType                = ZJRequest.GetFormString("info[PurchaseType]");
            string   OrderState                  = ZJRequest.GetFormString("info[OrderState]");
            string   CarUse                      = ZJRequest.GetFormString("info[CarUse]");
            int      OffAddressOnCardReport      = (ZJRequest.GetFormInt("info[OffAddressOnCardReport]"));
            int      InvoiceDiffer               = ZJRequest.GetFormInt("info[InvoiceDiffer]");
            int      IsApplyMaxCustomerResources = ZJRequest.GetFormInt("info[IsApplyMaxCustomerResources]");
            int      hiddenDealerId              = ZJRequest.GetFormInt("info[hiddenDealerId]");
            int      hiddenCustomerId            = ZJRequest.GetFormInt("info[hiddenCustomerId]");
            string   RecordName                  = ZJRequest.GetFormString("info[RecordName]");
            string   Watchmaker                  = ZJRequest.GetFormString("info[Watchmaker]");
            int      DifferentPlace              = ZJRequest.GetFormInt("info[DifferentPlace]");
            string   InvoiceCustomerInfo         = ZJRequest.GetFormString("info[FN_InvoiceName]");

            Common.Entity.Order order = new Common.Entity.Order();
            order.BuyWay                      = BuyWay;
            order.Code                        = orderNo;
            order.CreateTime                  = CreateTime;
            order.PurchaseType                = PurchaseType;
            order.OrderState                  = OrderState;
            order.CarUse                      = CarUse;
            order.OffAddressOnCardReport      = OffAddressOnCardReport;
            order.InvoiceAndCustomerAtypism   = InvoiceDiffer;
            order.IsApplyMaxCustomerResources = IsApplyMaxCustomerResources;
            order.CustomerID                  = hiddenCustomerId;
            order.DealerID                    = hiddenDealerId;
            order.RecordName                  = RecordName;
            order.Watchmaker                  = Watchmaker;
            order.DifferentPlace              = DifferentPlace;
            order.OrderType                   = 1; // 订单类别:订单为1,销售单为2
            order.InvoiceCustomerInfo         = InvoiceCustomerInfo;
            string result = "";
            List <Common.Entity.Order> list = new List <Common.Entity.Order>();
            string username = context.User.Identity.Name;

            Common.SysUserEntity model = new BLL.sysUser().GetSysUserByLoginName(username);
            if (opType == "update")
            {
                order.PKID = Convert.ToInt32(context.Request["info[HidOrderID]"]);

                if (new BLL.Order().GetOrderByPKID(order.PKID).ToExamineState >= 300)
                {
                    result = "已经进行配车的订单无法进行更改。";
                }
            }

            Hashtable CarDemandSort2Guid = new Hashtable();
            string    arrCar             = context.Request.Form["arrCar"];
            List <Common.Entity.CarPurchase> carsDemand = JsonConvert.DeserializeObject <List <Common.Entity.CarPurchase> >(arrCar);
            bool hasInvalidData = false;
            IDictionary <string, IList <Common.Entity.CarPurchase> > demandCars = new Dictionary <string, IList <Common.Entity.CarPurchase> >();

            demandCars.Add("exist", new List <Common.Entity.CarPurchase>());
            demandCars.Add("new", new List <Common.Entity.CarPurchase>());
            foreach (Common.Entity.CarPurchase cd in carsDemand)
            {
                cd.IsApplyMaxCustomerResources = "1";
                cd.OrderID = order.PKID;
                if ((0 == cd.PKID))
                {
                    demandCars["new"].Add(cd);
                    CarDemandSort2Guid.Add(cd.AddSortNo, cd.PKID);
                }
                else
                {
                    demandCars["exist"].Add(cd);
                }
                if ("COASTER" == cd.CarName.Trim().ToUpper())
                {
                    if (string.IsNullOrEmpty(cd.OldNo) || string.IsNullOrEmpty(cd.RuckSack))
                    {
                        hasInvalidData = true;
                    }
                }
            }
            IDictionary <string, IList <Common.Entity.CarRecord> > payCars = new Dictionary <string, IList <Common.Entity.CarRecord> >();
            List <Common.Entity.CarRecord> parList = new List <Common.Entity.CarRecord>();

            payCars.Add("exist", new List <Common.Entity.CarRecord>());
            payCars.Add("new", new List <Common.Entity.CarRecord>());
            if (hasInvalidData && ("协商" != order.OrderState))
            {
                order.OrderState = "协商";
                result           = "订单已经被强制设置为协商状态,有不符合规范的订购信息(请检查COASTER车型信息是否填写完全)。";
            }
            if (opType == "update")
            {
                new BLL.Order().Update(order, demandCars, payCars);
                //new BLL.Order().Update(order, carsDemand, parList);
            }
            else
            {
                new BLL.Order().Add(model.Name, order, demandCars, payCars);
            }
            if ((isConfirmData) && string.IsNullOrEmpty(result))
            {
                int?demandCount = demandCars["new"].Sum(p => p.RequirementNumber) + demandCars["exist"].Sum(p => p.RequirementNumber);
                if (!CommonFunction.CheckOrderAttach(order.PKID, "attachRequireOrder"))
                {
                    result = "电子资料不全。具体要求查看在线帮助。";
                }
                else if ((demandCount > 0) && new BLL.Order().CheckSubmitOrders(order.CustomerID, order.DealerID))
                {
                    bool directSubmit = bool.Parse(ConfigurationManager.AppSettings["directSubmitOrders"]);
                    new BLL.Order().SubmitOrders(model.Name, order.PKID.ToString("D"), order.CustomerID.ToString("D"), order.DealerID, directSubmit);
                }
                else
                {
                    result = "订单已保存,但订单不符合提交需求,请修改后提交。请检查<BR>1.车辆需求是否填写<BR>2.经销店以及客户联系人是否填写<BR>";
                }
            }
            context.Response.Write("{\"msg\":\" " + result + "\",\"state\":\"true\"}");
        }