Beispiel #1
0
        /// <summary>
        /// 获取表单创建初始绑定
        /// </summary>
        /// <returns></returns>
        public async Task <SaleBillModel> GetInitDataAsync(bool force = false, CancellationToken calToken = default)
        {
            try
            {
                int storeId = Settings.StoreId;
                int userId  = Settings.UserId;

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

                var cacheKey = RefitServiceBuilder.Cacher("SaleBillService.GetInitDataAsync", storeId, userId);
                var results  = await _makeRequest.StartUseCache(api.GetInitDataAsync(storeId, userId, calToken), cacheKey, force, calToken);

                if (results != null && results?.Code >= 0)
                {
                    return(results?.Data);
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception e)
            {
                e.HandleException();
                return(null);
            }
        }
Beispiel #2
0
        /// <summary>
        /// 获取指定单据类型的收付款方式
        /// </summary>
        /// <param name="billTypeId"></param>
        /// <returns></returns>
        public async Task <IList <AccountingOptionModel> > GetPaymentMethodsAsync(int billTypeId = 0, bool force = false, CancellationToken calToken = default)
        {
            try
            {
                int storeId = Settings.StoreId;
                int userId  = Settings.UserId;

                var api      = RefitServiceBuilder.Build <IAccountingApi>(URL);
                var cacheKey = RefitServiceBuilder.Cacher("GetPaymentMethodsAsync", storeId, billTypeId);
                var results  = await _makeRequest.StartUseCache(api.GetPaymentMethodsAsync(storeId, billTypeId, calToken), cacheKey, force, calToken);

                if (results != null && results?.Code >= 0)
                {
                    return(results?.Data.ToList());
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception e)
            {
                e.HandleException();
                return(null);
            }
        }
Beispiel #3
0
        /// <summary>
        /// 获取单据
        /// </summary>
        /// <param name="billId"></param>
        /// <returns></returns>
        public async Task <ExchangeBillModel> GetBillAsync(int billId, bool force = false, CancellationToken calToken = default)
        {
            var model = new ExchangeBillModel();

            try
            {
                int storeId = Settings.StoreId;
                int userId  = Settings.UserId;

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

                var cacheKey = RefitServiceBuilder.Cacher("ExchangeBillService.GetBillAsync", storeId, userId, billId);
                var results  = await _makeRequest.StartUseCache(api.GetBillAsync(storeId, userId, billId, calToken), cacheKey, force, calToken);

                if (results != null && results?.Code >= 0)
                {
                    model = results?.Data;
                }
                return(model);
            }
            catch (Exception e)
            {
                e.HandleException();
                return(null);
            }
        }
Beispiel #4
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);
            }
        }
Beispiel #5
0
        /// <summary>
        /// 获取全部盘点单据
        /// </summary>
        /// <param name="makeuserId"></param>
        /// <param name="inventoryPerson"></param>
        /// <param name="wareHouseId"></param>
        /// <param name="billNumber"></param>
        /// <param name="remark"></param>
        /// <param name="auditedStatus"></param>
        /// <param name="startTime"></param>
        /// <param name="endTime"></param>
        /// <param name="inventoryStatus"></param>
        /// <param name="showReverse"></param>
        /// <param name="sortByCompletedTime"></param>
        /// <param name="pagenumber"></param>
        /// <param name="pageSize"></param>
        /// <returns></returns>
        public async Task <IList <InventoryPartTaskBillModel> > GetInventoryAllsAsync(int?makeuserId, int?inventoryPerson, int?wareHouseId, string billNumber, string remark, bool?auditedStatus = null, DateTime?startTime = null, DateTime?endTime = null, int?inventoryStatus = -1, bool?showReverse = null, bool?sortByCompletedTime = null, int pagenumber = 0, int pageSize = 20, bool force = false, CancellationToken calToken = default)
        {
            try
            {
                int storeId = Settings.StoreId;
                int userId  = Settings.UserId;

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

                var cacheKey = RefitServiceBuilder.Cacher("GetInventoryAllsAsync", storeId,
                                                          makeuserId,
                                                          inventoryPerson,
                                                          wareHouseId,
                                                          billNumber,
                                                          remark,
                                                          auditedStatus,
                                                          startTime,
                                                          endTime,
                                                          inventoryStatus,
                                                          showReverse,
                                                          sortByCompletedTime,
                                                          pagenumber,
                                                          pageSize);

                var results = await _makeRequest.StartUseCache(api.GetInventoryAllsAsync(storeId,
                                                                                         makeuserId,
                                                                                         inventoryPerson,
                                                                                         wareHouseId,
                                                                                         billNumber,
                                                                                         remark,
                                                                                         auditedStatus,
                                                                                         startTime,
                                                                                         endTime,
                                                                                         inventoryStatus,
                                                                                         showReverse,
                                                                                         sortByCompletedTime,
                                                                                         pagenumber,
                                                                                         pageSize, calToken),
                                                               cacheKey, force, calToken);

                if (results != null && results?.Code >= 0)
                {
                    return(results?.Data.ToList());
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception e)
            {
                e.HandleException();
                return(null);
            }
        }
Beispiel #6
0
        /// <summary>
        /// 库存查询
        /// </summary>
        /// <param name="args"></param>
        /// <returns></returns>
        public async Task <IList <StockReportProduct> > GetStocksAsync(int?wareHouseId = 0, int?categoryId = 0, int?productId = 0, string productName = "", int?brandId = 0, bool?status = null, int?maxStock = 0, bool?showZeroStack = null, int pagenumber = 50, bool force = false, CancellationToken calToken = default)
        {
            try
            {
                int storeId = Settings.StoreId;
                int userId  = Settings.UserId;

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

                var cacheKey = RefitServiceBuilder.Cacher("GetStocksAsync", storeId,
                                                          wareHouseId,
                                                          categoryId,
                                                          productId,
                                                          productName,
                                                          brandId,
                                                          status,
                                                          maxStock,
                                                          showZeroStack,
                                                          pagenumber);

                var results = await _makeRequest.StartUseCache(api.GetStocksAsync(storeId,
                                                                                  wareHouseId,
                                                                                  categoryId,
                                                                                  productId,
                                                                                  productName,
                                                                                  brandId,
                                                                                  status,
                                                                                  maxStock,
                                                                                  showZeroStack,
                                                                                  pagenumber, calToken),
                                                               cacheKey, force, calToken);

                if (results != null && results?.Code >= 0)
                {
                    return(results?.Data);
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception e)
            {
                e.HandleException();
                return(null);
            }
        }