|
@ -17,6 +17,7 @@ using System.Windows; |
|
|
using System.Windows.Input; |
|
|
using System.Windows.Input; |
|
|
using BBWY.Common.Extensions; |
|
|
using BBWY.Common.Extensions; |
|
|
using BBWY.Client.Views.FinancialTerminal; |
|
|
using BBWY.Client.Views.FinancialTerminal; |
|
|
|
|
|
using Newtonsoft.Json; |
|
|
|
|
|
|
|
|
namespace BBWY.Client.ViewModels |
|
|
namespace BBWY.Client.ViewModels |
|
|
{ |
|
|
{ |
|
@ -30,7 +31,6 @@ namespace BBWY.Client.ViewModels |
|
|
private bool onlyException; |
|
|
private bool onlyException; |
|
|
private PurchaseOrderService purchaseOrderService; |
|
|
private PurchaseOrderService purchaseOrderService; |
|
|
private FinancialTerminalService financialTerminalService; |
|
|
private FinancialTerminalService financialTerminalService; |
|
|
private Department selectedDepartment; |
|
|
|
|
|
private DateTime startDate; |
|
|
private DateTime startDate; |
|
|
private DateTime endDate; |
|
|
private DateTime endDate; |
|
|
private Shop selectResultShop; |
|
|
private Shop selectResultShop; |
|
@ -38,17 +38,6 @@ namespace BBWY.Client.ViewModels |
|
|
private bool noChooseFundType; |
|
|
private bool noChooseFundType; |
|
|
private string searchResultPurchaseOrder; |
|
|
private string searchResultPurchaseOrder; |
|
|
private Platform? selectPurchasePlatform; |
|
|
private Platform? selectPurchasePlatform; |
|
|
public Department SelectedDepartment |
|
|
|
|
|
{ |
|
|
|
|
|
get => selectedDepartment; set |
|
|
|
|
|
{ |
|
|
|
|
|
if (Set(ref selectedDepartment, value)) |
|
|
|
|
|
{ |
|
|
|
|
|
foreach (var s in value.ShopList) |
|
|
|
|
|
s.IsSelected = false; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public DateTime StartDate { get => startDate; set { Set(ref startDate, value); } } |
|
|
public DateTime StartDate { get => startDate; set { Set(ref startDate, value); } } |
|
|
public DateTime EndDate { get => endDate; set { Set(ref endDate, value); } } |
|
|
public DateTime EndDate { get => endDate; set { Set(ref endDate, value); } } |
|
@ -59,6 +48,8 @@ namespace BBWY.Client.ViewModels |
|
|
|
|
|
|
|
|
public IList<Department> DepartmentList { get; set; } |
|
|
public IList<Department> DepartmentList { get; set; } |
|
|
|
|
|
|
|
|
|
|
|
public IList<Shop> ShopList { get; set; } |
|
|
|
|
|
|
|
|
public IList<AuditPayBill> ShowAuditPayBillList { get; set; } |
|
|
public IList<AuditPayBill> ShowAuditPayBillList { get; set; } |
|
|
|
|
|
|
|
|
public AuditFile SelectAuditFile |
|
|
public AuditFile SelectAuditFile |
|
@ -136,6 +127,7 @@ namespace BBWY.Client.ViewModels |
|
|
this.financialTerminalService = financialTerminalService; |
|
|
this.financialTerminalService = financialTerminalService; |
|
|
|
|
|
|
|
|
DepartmentList = new ObservableCollection<Department>(); |
|
|
DepartmentList = new ObservableCollection<Department>(); |
|
|
|
|
|
ShopList = new ObservableCollection<Shop>(); |
|
|
AuditFileList = new ObservableCollection<AuditFile>(); |
|
|
AuditFileList = new ObservableCollection<AuditFile>(); |
|
|
AuditPayBillList = new List<AuditPayBill>(); |
|
|
AuditPayBillList = new List<AuditPayBill>(); |
|
|
ShowAuditPayBillList = new ObservableCollection<AuditPayBill>(); |
|
|
ShowAuditPayBillList = new ObservableCollection<AuditPayBill>(); |
|
@ -144,11 +136,31 @@ namespace BBWY.Client.ViewModels |
|
|
EndDate = DateTime.Now.Date; |
|
|
EndDate = DateTime.Now.Date; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void OnDeparmentSelectionChanged() |
|
|
|
|
|
{ |
|
|
|
|
|
ShopList.Clear(); |
|
|
|
|
|
foreach (var d in DepartmentList) |
|
|
|
|
|
{ |
|
|
|
|
|
if (!d.IsSelected) |
|
|
|
|
|
continue; |
|
|
|
|
|
foreach (var s in d.ShopList) |
|
|
|
|
|
{ |
|
|
|
|
|
s.IsSelected = false; |
|
|
|
|
|
ShopList.Add(s); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
private void LoadDepartment() |
|
|
private void LoadDepartment() |
|
|
{ |
|
|
{ |
|
|
foreach (var d in globalContext.User.DepartmentList) |
|
|
var dlist = JsonConvert.DeserializeObject<IList<Department>>(JsonConvert.SerializeObject(globalContext.User.DepartmentList)); |
|
|
|
|
|
foreach (var d in dlist) |
|
|
|
|
|
{ |
|
|
|
|
|
d.IsSelected = false; |
|
|
DepartmentList.Add(d); |
|
|
DepartmentList.Add(d); |
|
|
SelectedDepartment = DepartmentList[0]; |
|
|
d.OnIsSelectedChanged = OnDeparmentSelectionChanged; |
|
|
|
|
|
} |
|
|
|
|
|
ShopList.Clear(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private void SearchHistory() |
|
|
private void SearchHistory() |
|
@ -157,7 +169,7 @@ namespace BBWY.Client.ViewModels |
|
|
return; |
|
|
return; |
|
|
ClearAudit(); |
|
|
ClearAudit(); |
|
|
IsLoading = true; |
|
|
IsLoading = true; |
|
|
var importShopIds = string.Join(',', SelectedDepartment.ShopList.Where(s => s.IsSelected).Select(s => s.ShopId)); |
|
|
var importShopIds = string.Join(',', ShopList.Where(s => s.IsSelected).Select(s => s.ShopId)); |
|
|
Task.Factory.StartNew(() => financialTerminalService.GetAuditPayBillList(importShopIds, StartDate, EndDate)).ContinueWith(t => |
|
|
Task.Factory.StartNew(() => financialTerminalService.GetAuditPayBillList(importShopIds, StartDate, EndDate)).ContinueWith(t => |
|
|
{ |
|
|
{ |
|
|
IsLoading = false; |
|
|
IsLoading = false; |
|
@ -173,7 +185,7 @@ namespace BBWY.Client.ViewModels |
|
|
{ |
|
|
{ |
|
|
foreach (var b in list) |
|
|
foreach (var b in list) |
|
|
{ |
|
|
{ |
|
|
b.Init(SelectedDepartment.ShopList); |
|
|
b.Init(ShopList); |
|
|
AuditPayBillList.Add(b); |
|
|
AuditPayBillList.Add(b); |
|
|
} |
|
|
} |
|
|
SearchLocal(); |
|
|
SearchLocal(); |
|
@ -186,7 +198,7 @@ namespace BBWY.Client.ViewModels |
|
|
{ |
|
|
{ |
|
|
if (IsLoading) |
|
|
if (IsLoading) |
|
|
return; |
|
|
return; |
|
|
if (AuditPayBillList.Count() == 0 || !SelectedDepartment.ShopList.Any(s => s.IsSelected)) |
|
|
if (AuditPayBillList.Count() == 0 || !ShopList.Any(s => s.IsSelected)) |
|
|
{ |
|
|
{ |
|
|
MessageBox.Show("审核数据不全", "提示"); |
|
|
MessageBox.Show("审核数据不全", "提示"); |
|
|
return; |
|
|
return; |
|
@ -197,7 +209,7 @@ namespace BBWY.Client.ViewModels |
|
|
new ManualResetEvent(false) |
|
|
new ManualResetEvent(false) |
|
|
}; |
|
|
}; |
|
|
IsLoading = true; |
|
|
IsLoading = true; |
|
|
var shopList = SelectedDepartment.ShopList.Where(s => s.IsSelected).ToList(); |
|
|
var shopList = ShopList.Where(s => s.IsSelected).ToList(); |
|
|
var sDate = StartDate.AddDays(-5); |
|
|
var sDate = StartDate.AddDays(-5); |
|
|
var eDate = EndDate; |
|
|
var eDate = EndDate; |
|
|
Task.Factory.StartNew(() => |
|
|
Task.Factory.StartNew(() => |
|
@ -529,7 +541,7 @@ namespace BBWY.Client.ViewModels |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
var importShopIds = string.Join(',', SelectedDepartment.ShopList.Where(s => s.IsSelected).Select(s => s.ShopId)); |
|
|
var importShopIds = string.Join(',', ShopList.Where(s => s.IsSelected).Select(s => s.ShopId)); |
|
|
|
|
|
|
|
|
var replaceResponse = financialTerminalService.IsExistAuditPayBill(importShopIds, StartDate, EndDate); |
|
|
var replaceResponse = financialTerminalService.IsExistAuditPayBill(importShopIds, StartDate, EndDate); |
|
|
if (!replaceResponse.Success) |
|
|
if (!replaceResponse.Success) |
|
@ -570,7 +582,7 @@ namespace BBWY.Client.ViewModels |
|
|
{ |
|
|
{ |
|
|
if (ShowAuditPayBillList.Count == 0) |
|
|
if (ShowAuditPayBillList.Count == 0) |
|
|
return; |
|
|
return; |
|
|
var shopNames = string.Join(',', SelectedDepartment.ShopList.Where(s => s.IsSelected).Select(s => s.ShopName)); |
|
|
var shopNames = string.Join(',', ShopList.Where(s => s.IsSelected).Select(s => s.ShopName)); |
|
|
|
|
|
|
|
|
var ew = new ProcurementAuditExcelExport(); |
|
|
var ew = new ProcurementAuditExcelExport(); |
|
|
if (ew.ShowDialog() != true) |
|
|
if (ew.ShowDialog() != true) |
|
@ -587,7 +599,7 @@ namespace BBWY.Client.ViewModels |
|
|
else |
|
|
else |
|
|
{ |
|
|
{ |
|
|
fileName = $"{StartDate:yyyy-MM-dd}_{EndDate:yyyy-MM-dd}_{shopNames}_资金类型汇总.csv"; |
|
|
fileName = $"{StartDate:yyyy-MM-dd}_{EndDate:yyyy-MM-dd}_{shopNames}_资金类型汇总.csv"; |
|
|
saveList.Add($"序号,资金类型,{string.Join(',', SelectedDepartment.ShopList)},汇总"); |
|
|
saveList.Add($"序号,资金类型,{string.Join(',', ShopList)},汇总"); |
|
|
var capitalGroups = ShowAuditPayBillList.Where(p => p.AuditCapitalType != null).GroupBy(p => p.AuditCapitalType); |
|
|
var capitalGroups = ShowAuditPayBillList.Where(p => p.AuditCapitalType != null).GroupBy(p => p.AuditCapitalType); |
|
|
var index = 1; |
|
|
var index = 1; |
|
|
var rowBuilder = new StringBuilder(); |
|
|
var rowBuilder = new StringBuilder(); |
|
@ -595,7 +607,7 @@ namespace BBWY.Client.ViewModels |
|
|
{ |
|
|
{ |
|
|
var sum = 0M; |
|
|
var sum = 0M; |
|
|
rowBuilder.Append($"{index},{capitalGroup.Key},"); |
|
|
rowBuilder.Append($"{index},{capitalGroup.Key},"); |
|
|
foreach (var shop in SelectedDepartment.ShopList) |
|
|
foreach (var shop in ShopList) |
|
|
{ |
|
|
{ |
|
|
var currentShopCapitalGroup = capitalGroup.Where(p => p.BelongShopId == shop.ShopId); |
|
|
var currentShopCapitalGroup = capitalGroup.Where(p => p.BelongShopId == shop.ShopId); |
|
|
var amount = 0M; |
|
|
var amount = 0M; |
|
@ -641,5 +653,7 @@ namespace BBWY.Client.ViewModels |
|
|
{ |
|
|
{ |
|
|
auditPayBill.AuditCapitalTypeInputMode = 0; |
|
|
auditPayBill.AuditCapitalTypeInputMode = 0; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|