コード例 #1
0
        protected override void Execute(object state)
        {
            var model = state as LegworkAutoConfirmTimeModel;

            if (null == model)
            {
                return;
            }

            try
            {
                //从备份区将备份删除
                DeleteBackAfterDone(model.OrderID);

                var lastOrder = LegworkOrderProvder.GetLegworkOrder(model.OrderID);

                if (null == lastOrder)
                {
                    throw new CustomException(string.Format("〖跑腿订单(ID:{0})〗信息已不存在!", model.OrderID));
                }

                if (lastOrder.Status != (int)LegworkOrderStatus.Delivered)
                {
                    throw new CustomException(string.Format("〖跑腿订单(ID:{0})〗状态已发生变更,不能自动完成收货!", lastOrder.OrderID));
                }

                //if (model.ShipTime != model.ShipTime) throw new CustomException(string.Format("订单(编号{0})不能确定发货时间,不能自动完成收货!", lastOrder.OrderCode));

                //结算并自动收货
                var settlement = LegworkOrderProvder.UpdateAutoConfirmTime(lastOrder);

                string message = string.Empty;

                if (settlement.Result)
                {
                    message = string.Format("〖跑腿订单(ID:{0})〗自动确认收货完成!", lastOrder.OrderID);
                }
                else
                {
                    message = string.Format("〖跑腿订单(ID:{0})〗自动确认收货失败!", lastOrder.OrderID);
                }

                RunLogger(message);
            }
            catch (Exception ex)
            {
                this.OnThrowException(ex);
            }
            finally
            {
                Schedulers.Remove(model.OrderID);
            }
        }
コード例 #2
0
        protected override void Execute(object state)
        {
            var model = state as LegworkOrderTimeoutModel;

            if (null == model)
            {
                return;
            }

            try
            {
                //从备份区将备份删除
                DeleteBackAfterDone(model.OrderID);

                var lastOrder = LegworkOrderProvder.GetLegworkOrder(model.OrderID);

                if (null == lastOrder)
                {
                    throw new CustomException(string.Format("〖跑腿订单(ID:{0})〗信息已不存在!", model.OrderID));
                }

                if (lastOrder.Status != (int)LegworkOrderStatus.WaitingHandle)
                {
                    throw new CustomException(string.Format("〖跑腿订单(ID:{0})〗状态已发生变更,不能取消订单!", lastOrder.OrderID));
                }

                //结算并自动收货
                var settlement = LegworkOrderProvder.UpdateOrderTimeout(lastOrder);

                string message = string.Empty;

                if (settlement.Result)
                {
                    message = string.Format("〖跑腿订单(ID:{0})〗自动取消订单完成!", lastOrder.OrderID);
                }
                else
                {
                    message = string.Format("〖跑腿订单(ID:{0})〗自动取消订单失败!", lastOrder.OrderID);
                }

                RunLogger(message);
            }
            catch (Exception ex)
            {
                this.OnThrowException(ex);
            }
            finally
            {
                Schedulers.Remove(model.OrderID);
            }
        }