示例#1
0
        /// <summary>
        /// 获取库存
        /// </summary>
        /// <returns></returns>
        public async Task <IList <WareHouseModel> > GetWareHousesAsync(BillTypeEnum btype, string searchStr = "", int pageIndex = 0, int pageSize = 50, bool force = false, CancellationToken calToken = default)
        {
            try
            {
                int storeId = Settings.StoreId;
                int userId  = Settings.UserId;

                var api = RefitServiceBuilder.Build <IWareHousesApi>(URL);

                var cacheKey = RefitServiceBuilder.Cacher("GetWareHousesAsync",
                                                          storeId,
                                                          userId,
                                                          (int)btype,
                                                          searchStr,
                                                          true,
                                                          pageIndex,
                                                          pageSize);

                var results = await _makeRequest.StartUseCache(api.GetWareHousesAsync(storeId,
                                                                                      userId,
                                                                                      (int)btype,
                                                                                      searchStr,
                                                                                      pageIndex,
                                                                                      pageSize,
                                                                                      calToken),
                                                               cacheKey,
                                                               true,
                                                               calToken,
                                                               TimeSpan.FromSeconds(5));

                if (results != null && results?.Code >= 0)
                {
                    return(results?.Data?.ToList());
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception e)
            {
                e.HandleException();
                return(null);
            }
        }
示例#2
0
        public async void GetSelectStock(BillTypeEnum btype, Action <PopData> call)
        {
            var _dialogView = new PopRadioButtonPage("选择库存", "", async() =>
            {
                var results = await _wareHousesService.GetWareHousesAsync(btype, force: this.ForceRefresh);
                if (results != null && results.Any())
                {
                    var popDatas = results?.Select(s =>
                    {
                        return(new PopData
                        {
                            Id = s?.Id ?? 0,
                            Column = s?.Name
                        });
                    })?.ToList();
                    return(popDatas);
                }
                else
                {
                    return(null);
                }
            });

            _dialogView.Completed += (sender, result) =>
            {
                try {
                    if (result != null)
                    {
                        call?.Invoke(result);
                    }
                }
                catch (Exception ex)
                {
                    Crashes.TrackError(ex);
                }
            };
            await PopupNavigation.Instance.PushAsync(_dialogView);
        }
示例#3
0
 public override Bill InitTemporary(DevExpress.Xpo.Session session, BillTypeEnum billType)
 {
     try
     {
         NAS.DAL.Invoice.SalesInvoice ret = null;
         ret = new DAL.Invoice.SalesInvoice(session)
         {
             BillId                   = Guid.NewGuid(),
             RowStatus                = Utility.Constant.ROWSTATUS_TEMP,
             CreateDate               = DateTime.Now,
             IssuedDate               = DateTime.Now,
             TaxClaimStatus           = Utility.Constant.VAT_NO_DECLARE,
             TaxCalculationType       = Utility.Constant.CALCULATION_TYPE_ON_ITEMS,
             PromotionCalculationType = Utility.Constant.CALCULATION_TYPE_ON_ITEMS,
             BillType                 = (byte)billType
         };
         ret.Save();
         return(ret);
     }
     catch (Exception)
     {
         throw;
     }
 }
示例#4
0
        public static string GetNavigation(BillTypeEnum type)
        {
            var app = AppDatas.Where(a => a.BillType == type).FirstOrDefault();

            return(app != null ? app.Navigation : "");
        }
示例#5
0
 public abstract Bill InitTemporary(Session session, BillTypeEnum billType);