diff --git a/BBWY.Client/Models/APIModel/Response/FinancialTerminal/AuditPayBillResponse.cs b/BBWY.Client/Models/APIModel/Response/FinancialTerminal/AuditPayBillResponse.cs index a32d97e3..489d0420 100644 --- a/BBWY.Client/Models/APIModel/Response/FinancialTerminal/AuditPayBillResponse.cs +++ b/BBWY.Client/Models/APIModel/Response/FinancialTerminal/AuditPayBillResponse.cs @@ -94,5 +94,7 @@ namespace BBWY.Client.Models public string ImportShopIds { get; set; } public string ErrorMessage { get; set; } + + public AuditCapitalType? AuditCapitalType { get; set; } } } diff --git a/BBWY.Client/Models/Enums.cs b/BBWY.Client/Models/Enums.cs index a3f797b9..f6300212 100644 --- a/BBWY.Client/Models/Enums.cs +++ b/BBWY.Client/Models/Enums.cs @@ -126,7 +126,7 @@ } /// - /// 账单类型 + /// 资金类型 /// public enum AuditCapitalType { diff --git a/BBWY.Client/Models/FinancialTerminal/ProcurementAudit/AuditPayBill.cs b/BBWY.Client/Models/FinancialTerminal/ProcurementAudit/AuditPayBill.cs index dcb36285..ab34b25a 100644 --- a/BBWY.Client/Models/FinancialTerminal/ProcurementAudit/AuditPayBill.cs +++ b/BBWY.Client/Models/FinancialTerminal/ProcurementAudit/AuditPayBill.cs @@ -19,7 +19,7 @@ namespace BBWY.Client.Models /// /// 账单类型 /// - public PayBillType PayBillType { get; set; } + public PayBillType? PayBillType { get; set; } /// /// 商家订单号 diff --git a/BBWY.Client/ViewModels/FinancialTerminal/ProcurementAuditViewModel.cs b/BBWY.Client/ViewModels/FinancialTerminal/ProcurementAuditViewModel.cs index b13483a5..2bd8e085 100644 --- a/BBWY.Client/ViewModels/FinancialTerminal/ProcurementAuditViewModel.cs +++ b/BBWY.Client/ViewModels/FinancialTerminal/ProcurementAuditViewModel.cs @@ -15,6 +15,7 @@ using System.Threading; using System.Threading.Tasks; using System.Windows; using System.Windows.Input; +using BBWY.Common.Extensions; namespace BBWY.Client.ViewModels { @@ -119,7 +120,7 @@ namespace BBWY.Client.ViewModels ImportAliPayBillCommand = new RelayCommand(ImportAliPayBill); SearchHistoryCommand = new RelayCommand(SearchHistory); SearchLocalCommand = new RelayCommand(SearchLocal); - ClearLocalConditionCommand = new RelayCommand(ClearLocalCondition); + ClearLocalConditionCommand = new RelayCommand(() => ClearLocalCondition()); SaveCommand = new RelayCommand(Save); this.purchaseOrderService = purchaseOrderService; this.financialTerminalService = financialTerminalService; @@ -144,6 +145,27 @@ namespace BBWY.Client.ViewModels { if (IsLoading) return; + ClearAudit(); + IsLoading = true; + var importShopIds = string.Join(',', SelectedDepartment.ShopList.Where(s => s.IsSelected).Select(s => s.ShopId)); + Task.Factory.StartNew(() => financialTerminalService.GetAuditPayBillList(importShopIds, StartDate, EndDate)).ContinueWith(t => + { + IsLoading = false; + var response = t.Result; + if (!response.Success) + { + MessageBox.Show(response.Msg, "查询账单"); + return; + } + + var list = response.Data.Map>(); + App.Current.Dispatcher.Invoke(() => + { + foreach (var b in list) + AuditPayBillList.Add(b); + SearchLocal(); + }); + }); } @@ -289,6 +311,7 @@ namespace BBWY.Client.ViewModels NoChooseFundType = false; NoMatchPurchaseOrder = false; SearchResultPurchaseOrder = string.Empty; + SelectPurchasePlatform = null; } private (string ErrorMessage, string FileName, List Lines) ImportAuditFile(AuditFileType auditFileType) @@ -402,14 +425,16 @@ namespace BBWY.Client.ViewModels } } - private void ClearLocalCondition() + private void ClearLocalCondition(bool isSearch = true) { OnlyException = false; NoMatchPurchaseOrder = false; NoChooseFundType = false; SelectResultShop = null; SelectPurchasePlatform = null; - SearchLocal(); + SearchResultPurchaseOrder = string.Empty; + if (isSearch) + SearchLocal(); } /// @@ -417,29 +442,31 @@ namespace BBWY.Client.ViewModels /// private void SearchLocal() { - if (SelectAuditFile == null) - return; - if (SelectAuditFile.AuditFileType == AuditFileType.账单) - { - IsShowPayBillPanel = true; - ShowAuditPayBillList.Clear(); - var where = AuditPayBillList.Where(b => b.BelongFileName == SelectAuditFile.FileName); - if (OnlyException) - where = where.Where(b => !string.IsNullOrEmpty(b.ErrorMessage)); - if (NoMatchPurchaseOrder) - where = where.Where(b => !string.IsNullOrEmpty(b.ErrorMessage) && b.ErrorMessage == "未匹配采购单"); - if (NoChooseFundType) - where = where.Where(b => !string.IsNullOrEmpty(b.ErrorMessage) && b.ErrorMessage == "未选资金类型"); - if (SelectResultShop != null) - where = where.Where(b => b.BelongShopId != null && b.BelongShopId.Value == SelectResultShop.ShopId); - if (!string.IsNullOrEmpty(SearchResultPurchaseOrder)) - where = where.Where(b => !string.IsNullOrEmpty(b.RelationPurchaseOrderId) && b.RelationPurchaseOrderId.Contains(SearchResultPurchaseOrder)); - if (SelectPurchasePlatform != null) - where = where.Where(b => b.PurchasePlatform == SelectPurchasePlatform); - var list = where.ToList(); - foreach (var b in list) - ShowAuditPayBillList.Add(b); - } + //if (SelectAuditFile == null) + // return; + //if (SelectAuditFile.AuditFileType == AuditFileType.账单) + //{ + IsShowPayBillPanel = true; + ShowAuditPayBillList.Clear(); + var where = AuditPayBillList.Where(b => true); + if (SelectAuditFile != null) + where = where.Where(b => b.BelongFileName == SelectAuditFile.FileName); + if (OnlyException) + where = where.Where(b => !string.IsNullOrEmpty(b.ErrorMessage)); + if (NoMatchPurchaseOrder) + where = where.Where(b => !string.IsNullOrEmpty(b.ErrorMessage) && b.ErrorMessage == "未匹配采购单"); + if (NoChooseFundType) + where = where.Where(b => !string.IsNullOrEmpty(b.ErrorMessage) && b.ErrorMessage == "未选资金类型"); + if (SelectResultShop != null) + where = where.Where(b => b.BelongShopId != null && b.BelongShopId.Value == SelectResultShop.ShopId); + if (!string.IsNullOrEmpty(SearchResultPurchaseOrder)) + where = where.Where(b => !string.IsNullOrEmpty(b.RelationPurchaseOrderId) && b.RelationPurchaseOrderId.Contains(SearchResultPurchaseOrder)); + if (SelectPurchasePlatform != null) + where = where.Where(b => b.PurchasePlatform == SelectPurchasePlatform); + var list = where.ToList(); + foreach (var b in list) + ShowAuditPayBillList.Add(b); + //} } private void Save() @@ -469,6 +496,7 @@ namespace BBWY.Client.ViewModels Task.Factory.StartNew(() => financialTerminalService.BatchInsertAuditPayBill(ShowAuditPayBillList)).ContinueWith(t => { + IsLoading = false; var insertResponse = t.Result; App.Current.Dispatcher.Invoke(() => { diff --git a/BBWY.Server.Model/Db/FinancialTerminal/AuditPayBill.cs b/BBWY.Server.Model/Db/FinancialTerminal/AuditPayBill.cs index d2e65c15..09fc969c 100644 --- a/BBWY.Server.Model/Db/FinancialTerminal/AuditPayBill.cs +++ b/BBWY.Server.Model/Db/FinancialTerminal/AuditPayBill.cs @@ -106,6 +106,9 @@ namespace BBWY.Server.Model.Db public string ImportShopIds { get; set; } public string ErrorMessage { get; set; } + + [Column(DbType = "int(1)", MapType = typeof(int?))] + public Enums.AuditCapitalType? AuditCapitalType { get; set;} } } diff --git a/BBWY.Server.Model/Enums.cs b/BBWY.Server.Model/Enums.cs index 285109e6..8f61b85f 100644 --- a/BBWY.Server.Model/Enums.cs +++ b/BBWY.Server.Model/Enums.cs @@ -167,5 +167,32 @@ 微信 = 1, 银行卡 = 2 } + + + /// + /// 资金类型 + /// + public enum AuditCapitalType + { + 当月商品采购 = 0, + 当月商品退款 = 1, + 上月商品采购 = 2, + 上月商品退款 = 3, + 批量采购商品 = 4, + 采购运费 = 5, + 入仓运费 = 6, + 售后成本 = 7, + 发票点数 = 8, + 快递单号 = 9, + 诚e赊还款 = 10, + 空单号 = 11, + 购买刷单号 = 12, + 手机费 = 13, + 质检报告 = 14, + 备用金转入 = 15, + 平台补贴 = 16, + 快递赔付 = 17, + 自定义 = 18 + } } }