|
|
|
@ -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<IList<AuditPayBill>>(); |
|
|
|
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<string> 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(); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -417,29 +442,31 @@ namespace BBWY.Client.ViewModels |
|
|
|
/// </summary>
|
|
|
|
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(() => |
|
|
|
{ |
|
|
|
|