/// <summary> /// 上交对账单(批量) /// </summary> /// <param name="data"></param> /// <param name="store"></param> /// <param name="userId"></param> /// <returns></returns> public async Task <APIResult <FinanceReceiveAccountBillSubmitModel> > SubmitAccountStatementAsync(FinanceReceiveAccountBillSubmitModel data, int id, CancellationToken calToken = default) { try { int storeId = Settings.StoreId; int userId = Settings.UserId; var api = RefitServiceBuilder.Build <IFinanceReceiveAccountApi>(URL); var results = await _makeRequest.Start(api.SubmitAccountStatementAsync(data, storeId, userId, id, calToken), calToken); return(results); } catch (Exception e) { e.HandleException(); return(null); } }
public ReconciliationDetailPageViewModel(INavigationService navigationService, IProductService productService, IUserService userService, ITerminalService terminalService, IWareHousesService wareHousesService, IAccountingService accountingService, IFinanceReceiveAccountService financeReceiveAccountService, IDialogService dialogService) : base(navigationService, productService, terminalService, userService, wareHousesService, accountingService, dialogService) { Title = "单据信息"; _financeReceiveAccountService = financeReceiveAccountService; //选择单据 this.WhenAnyValue(x => x.Selecter).Throttle(TimeSpan.FromMilliseconds(500)) .Skip(1) .Where(x => x != null) .SubOnMainThread(async x => { switch (x.BillType) { case (int)BillTypeEnum.SaleBill: await this.NavigateAsync("SaleBillPage", ("BillId", x.BillId)); break; case (int)BillTypeEnum.ReturnBill: await this.NavigateAsync("ReturnBillPage", ("BillId", x.BillId)); break; case (int)BillTypeEnum.CashReceiptBill: await this.NavigateAsync("CashReceiptBillPage", ("BillId", x.BillId)); break; case (int)BillTypeEnum.AdvanceReceiptBill: await this.NavigateAsync("AdvanceReceiptBillPage", ("BillId", x.BillId)); break; case (int)BillTypeEnum.CostExpenditureBill: await this.NavigateAsync("CostExpenditureBillPage", ("BillId", x.BillId)); break; default: break; } Selecter = null; }).DisposeWith(DeactivateWith); //选择业务员 this.WhenAnyValue(x => x.Filter.BusinessUserId) .Skip(1) .Where(x => x > 0) .Subscribe(x => { var fillter = this.TempBills.Where(s => s.UserId == x).ToList(); this.Bills = new ObservableCollection <FinanceReceiveAccountBillModel>(fillter); }); //全选 this.WhenAnyValue(x => x.SelectedAll) .Subscribe(x => { foreach (var b in this.Bills) { b.Selected = x; } CalcSum(); var count = this.Bills.Where(s => s.Selected).Count(); this.ConfirmText = $"确认上交({count})"; }); //打印单据 this.PrintCommand = ReactiveCommand.Create(() => { Alert("请选择单据!"); }); //上交对账单 this.SubmitDataCommand = ReactiveCommand.CreateFromTask <object, Unit>(async(e) => { var bills = this.Bills.Where(s => s.Selected == true).ToList(); if (bills.Count == 0) { Alert("请选择单据!"); return(Unit.Default); } var postData = new FinanceReceiveAccountBillSubmitModel() { Items = bills }; return(await SubmitAsync(postData, 0, _financeReceiveAccountService.SubmitAccountStatementAsync, (result) => { //移除当前 bills.ForEach(b => { this.Bills.Remove(b); }); })); }); }