Esempio n. 1
0
        /// <summary>
        /// 批量修改网单的状态
        /// </summary>
        /// <param name="OrderId"></param>
        /// <param name="os"></param>
        /// <param name="ServiceId"></param>
        /// <returns></returns>
        public int  UpdateServiceStatus(int[] OrderId, Order_Status os, int ServiceId)
        {
            int      num = 0;
            DateTime ServiceFinishTime = DateTime.Now;
            string   username          = "******";

            if (ServiceId > 0)
            {
                Sys_Users sys_users = new Sys_Users();
                sys_users.Id = ServiceId;
                if (sys_users.Load())
                {
                    username = sys_users.Name;
                }
            }
            for (int i = 0; i < OrderId.Length; i++)
            {
                string sql = string.Format("update OrderStatus set ServiceStatus ='{0}' ,ServiceFinishTime='{1}' where OrderId ='{2}'", os, ServiceFinishTime, OrderId[i]);
                if (m_dbo.ExecuteNonQuery(sql))
                {
                    //修改订单的UserId
                    Order order = new Order();
                    order.Id = OrderId[i];
                    order.Load();
                    order.UserId = ServiceId;
                    order.Save();

                    //添加订单状态明细
                    OrderStatusDetail osd = new OrderStatusDetail();
                    osd.IsInner   = 0;
                    osd.OrderId   = OrderId[i];
                    osd.Status    = "您的订单已通过审核!";
                    osd.UserId    = ServiceId;
                    osd.StatusId  = 2;
                    osd.TPIStatus = CommenClass.Order_Status.已接受.ToString();
                    osd.UserName  = username;
                    if (osd.Save() > 0)
                    {
                        num += 1;
                    }
                }
            }
            return(num);
        }
Esempio n. 2
0
        /// <summary>
        ///修改订单的状态
        /// ERP FFeedBack.cs 中调用
        /// </summary>
        /// <param name="StatusType1"></param>
        /// <param name="StatusValue1"></param>
        /// <param name="UserId"></param>
        /// <returns></returns>
        public bool UpdateStatus(OrderStatusType StatusType1, Order_Status StatusValue1, int UserId)
        {
            string StatusType  = StatusType1.ToString();
            string StatusValue = StatusValue1.ToString();

            this.Id = Id;
            this.Load();
            string Status   = string.Empty;
            int    IsInner  = -1;
            int    statusId = 0;

            switch (StatusType)
            {
            case "客服":
                this.ServiceStatus = StatusValue;
                this.ServiceId     = UserId;
                if (StatusValue == "已完成")
                {
                    this.ServiceFinishTime = DateTime.Now;
                    Status  = "您的订单已确认";
                    IsInner = 0;
                }
                else
                {
                    IsInner = -1;
                    this.ServiceFinishTime = new DateTime(1900, 1, 1);
                }
                break;

            case "采购":
                this.PurchaseStatus = StatusValue;
                if (StatusValue == "已完成")
                {
                    this.PurchaseFinishTime = DateTime.Now;
                }
                else if (StatusValue == "已接受")
                {
                    IsInner  = 1;
                    Status   = "采购已接受!";
                    statusId = 3;
                    this.PurchaseFinishTime = new DateTime(1900, 1, 1);
                }
                else
                {
                    IsInner = -1;
                    this.PurchaseFinishTime = new DateTime(1900, 1, 1);
                }
                break;

            case "仓库":
                this.StoreStatus = StatusValue;
                if (StatusValue == "已完成")
                {
                    this.StoreFinishTime = DateTime.Now;
                    statusId             = 4;
                    Status  = "您商品已出库";
                    IsInner = 1;
                }
                else if (StatusValue == "已接受")
                {
                    IsInner              = 0;
                    Status               = "您的订单正在分拣!";
                    statusId             = 3;
                    this.StoreFinishTime = new DateTime(1900, 1, 1);
                }
                else
                {
                    IsInner = -1;
                    this.StoreFinishTime = new DateTime(1900, 1, 1);
                }
                break;

            case "配送":
                this.DeliveryStatus = StatusValue;
                if (StatusValue == "已完成")
                {
                    this.DeliveryFinishTime = DateTime.Now;
                    Status   = "您的订单已配送完成!";
                    statusId = 5;
                    IsInner  = 0;
                }
                else if (StatusValue == "已接受")
                {
                    IsInner  = 0;
                    statusId = 4;
                    Status   = "您的订单已分配到配送员,我们会尽快送达!";
                    this.DeliveryFinishTime = new DateTime(1900, 1, 1);
                }
                else
                {
                    IsInner = -1;
                    this.DeliveryFinishTime = new DateTime(1900, 1, 1);
                }
                break;

            case "回单":
                this.FeedBackStatus = StatusValue;

                if (StatusValue == "已完成")
                {
                    IsInner  = 1;
                    Status   = "订单已完成!";
                    statusId = 6;
                    this.FeedBackFinishTime = DateTime.Now;
                }
                else
                {
                    IsInner = -1;
                    this.FeedBackFinishTime = new DateTime(1900, 1, 1);
                }
                break;
            }
            if (this.Save() > 0)
            {
                if (IsInner >= 0)
                {
                    //添加订单状态明细
                    OrderStatusDetail osd = new OrderStatusDetail();
                    osd.IsInner   = IsInner;
                    osd.OrderId   = this.OrderId;
                    osd.Status    = Status;
                    osd.UserId    = UserId;
                    osd.StatusId  = statusId;
                    osd.TPIStatus = CommenClass.Order_Status.已完成.ToString();
                    if (osd.UserId == 0)
                    {
                        osd.UserName = "******";
                    }
                    else
                    {
                        Sys_Users sys_users = new Sys_Users();
                        sys_users.Id = osd.UserId;
                        if (sys_users.Load())
                        {
                            osd.UserName = sys_users.Name;
                        }
                    }
                    osd.Save();
                }
                return(true);
            }
            else
            {
                return(false);
            }
        }