示例#1
0
        /// <summary>
        /// 声明发货
        /// </summary>
        /// <param name="item"></param>
        /// <param name="acc"></param>
        /// <returns></returns>
        private async Task <bool> Shipment(ShipmentItem item, Account acc)
        {
            var api    = new APIClient(acc.User, acc.Pwd);
            var method = new OrderShipment()
            {
                LogisticsType = item.LogisticsType.Code,
                OrderNO       = item.OrderNO.Trim(),//如果有空格, StackTrace会为 []]
                SendType      = item.SendType,
                TrackingNO    = item.TrackNO.Trim()
            };
            var result = await api.Execute(method);

            //var result = new NormalResult() {
            //    Success = false,
            //    ErrorInfo = "TEST"
            //};
            item.Info   = result.ErrorInfo;
            item.Status = result.Success ? ShipmentStatus.Success : ShipmentStatus.Error;

            item.NotifyOfPropertyChange(() => item.Info);
            item.NotifyOfPropertyChange(() => item.Status);

            //Thread.Sleep(1000);
            return(result.Success);
        }
示例#2
0
 public void SendShipment(IEnumerable <BizEntity.Models.ShipmentItem> items)
 {
     foreach (var i in items)
     {
         var item = new ShipmentItem()
         {
             Account = i.Account,
             OrderNO = i.OrderNO,
             TrackNO = i.TrackNO
         };
         this.Items.Add(item);
         item.NotifyOfPropertyChange("OrderNO");
     }
 }
示例#3
0
        public void LoadData(ShipmentItem item)
        {
            if (!string.IsNullOrWhiteSpace(item.OrderNO))
            {
                var order = this.OrderBiz.GetOrder(item.OrderNO);
                if (order != null)
                {
                    item.Account     = order.Account;
                    item.Country     = order.Receiver.Country.ZhName;
                    item.Note        = order.Note != null ? order.Note.Note : "";
                    item.OrderStatus = order.Status;
                    item.Status      = ShipmentStatus.Ready;
                }
                else
                {
                    item.Account     = "";
                    item.Country     = "";
                    item.Note        = "";
                    item.OrderStatus = Entity.OrderStatus.UNKNOW;
                    item.Status      = ShipmentStatus.Warning;
                }
            }
            else
            {
                item.Account     = "";
                item.Country     = "";
                item.Note        = "";
                item.OrderStatus = Entity.OrderStatus.UNKNOW;
                item.Status      = ShipmentStatus.Warning;
            }

            item.NotifyOfPropertyChange(() => item.Account);
            item.NotifyOfPropertyChange(() => item.Country);
            item.NotifyOfPropertyChange(() => item.Note);
            item.NotifyOfPropertyChange(() => item.OrderStatus);
            item.NotifyOfPropertyChange(() => item.Status);
        }