コード例 #1
0
        /// <summary>
        /// 撤销物流配送回未配送状态,只当为配送中时
        /// </summary>
        /// <param name="orderId"></param>
        /// <param name="status"></param>
        /// <param name="modifyUser"></param>
        /// <returns></returns>
        public OpResult StatusRevert(string orderNo, StatusDistribution status, string modifyUser)
        {
            var result = new OpResult();

            try
            {
                var distribution = context.Distribution.Where(d => d.OrderNo == orderNo && d.IsDeleted != 1).FirstOrDefault();
                var order        = context.Orders.Where(o => o.No == orderNo && o.IsDeleted != 1).FirstOrDefault();
                if (distribution != null)
                {
                    if (distribution.Status != (StatusDistribution)status)
                    {
                        result.Successed = false;
                        result.Message   = "数据已过期,请刷新页面";
                    }
                    else
                    {
                        if (distribution.Status == StatusDistribution.Distributing)
                        {
                            distribution.Status    = StatusDistribution.DistributionPending;
                            distribution.BeginTime = null;//开始配送时间清空
                            order.Status           = OrderStatus.MakeCompleted;
                        }
                        distribution.ModifiedOn = DateTime.Now;
                        distribution.ModifiedBy = modifyUser;
                        context.SaveChanges();
                        result.Successed = true;
                        result.Message   = "操作成功";
                        result.Data      = distribution.Status;
                    }
                }
            }
            catch (Exception ex)
            {
                result.Successed = false;
                result.Message   = ex.Message;
            }
            return(result);
        }
コード例 #2
0
 public bool AreStatsValid()
 {
     return(ScoreDistribution?.Count(x => x.Amount > 0) >= 3 || AiringProgression?.Count >= 3 ||
            StatusDistribution?.Any(x => x.Amount >= 3) == true);
 }
コード例 #3
0
        public ActionResult StatusRevert(string orderNo, StatusDistribution status)
        {
            string modifyUserId = Helper.UserCache.CurrentUser.Id;

            return(Json(new DistributionService().StatusRevert(orderNo, status, modifyUserId)));
        }
コード例 #4
0
        public ActionResult StatusHandle(string orderNo, StatusDistribution status, bool isSMS)
        {
            string modifyUserId = Helper.UserCache.CurrentUser.Id;

            return(Json(new DistributionService().StatusHandle(orderNo, status, modifyUserId, isSMS)));
        }
コード例 #5
0
        /// <summary>
        /// 操作状态:未配送[开始Btn]->配送中[完成Btn]->配送完成;配送异常
        /// </summary>
        /// <param name="orderNo"></param>
        /// <param name="status"></param>
        /// <param name="modifyUser"></param>
        /// <returns></returns>
        public OpResult StatusHandle(string orderNo, StatusDistribution status, string modifyUser, bool isSMS)
        {
            var result    = new OpResult();
            var isSendMsg = false;

            try
            {
                var distribution = context.Distribution.Where(d => d.OrderNo == orderNo && d.IsDeleted != 1).FirstOrDefault();
                var order        = context.Orders.Where(o => o.No == orderNo && o.IsDeleted != 1).FirstOrDefault();
                if (distribution != null)
                {
                    if (distribution.Status != (StatusDistribution)status)
                    {
                        result.Successed = false;
                        result.Message   = "数据已过期,请刷新页面";
                    }
                    else
                    {
                        if (distribution.Status == StatusDistribution.DistributionPending)
                        {
                            distribution.Status    = StatusDistribution.Distributing;
                            distribution.BeginTime = DateTime.Now;
                            order.Status           = OrderStatus.Delivery;
                            if (isSMS)
                            {
                                isSendMsg = true;
                            }
                        }
                        else if (distribution.Status == StatusDistribution.Distributing)
                        {
                            distribution.Status  = StatusDistribution.Distributed;
                            distribution.EndTime = DateTime.Now;
                            order.Status         = OrderStatus.Completed;
                        }

                        distribution.ModifiedOn = DateTime.Now;
                        distribution.ModifiedBy = modifyUser;
                        context.SaveChanges();
                        result.Successed = true;
                        result.Message   = "操作成功";
                        result.Data      = new Dictionary <string, string>()
                        {
                            { "status", ((int)distribution.Status).ToString() },
                            { "beginTime", distribution.BeginTime.ToString() },
                            { "endTime", distribution.EndTime.ToString() },
                        };
                        if (order.Status == OrderStatus.Completed)
                        {//订单完成后更新会员信息
                            _orderService.CompletedOrderUpdateMemberInfo(order.No);
                        }
                    }
                }
                else
                {
                    result.Successed = false;
                    result.Message   = "操作失败";
                }
            }
            catch (Exception ex)
            {
                result.Successed = false;
                result.Message   = ex.Message;
            }

            //发送短信
            if (isSendMsg)
            {
                //SendBeginMessage(orderNo, new MsgTemplateService().GetMsgTempByCategory("Distribution"));
                SendBeginMessage(orderNo, DaYuConfig.BeginDeliveryTemplate);
            }
            return(result);
        }