diff --git a/BBWY.Client/Models/APIModel/Response/FinancialTerminal/AuditPayBillResponse.cs b/BBWY.Client/Models/APIModel/Response/FinancialTerminal/AuditPayBillResponse.cs
index 919983c2..a32d97e3 100644
--- a/BBWY.Client/Models/APIModel/Response/FinancialTerminal/AuditPayBillResponse.cs
+++ b/BBWY.Client/Models/APIModel/Response/FinancialTerminal/AuditPayBillResponse.cs
@@ -92,5 +92,7 @@ namespace BBWY.Client.Models
/// 导入时选择的店铺
///
public string ImportShopIds { get; set; }
+
+ public string ErrorMessage { get; set; }
}
}
diff --git a/BBWY.Client/Models/FinancialTerminal/ProcurementAudit/AuditPayBill.cs b/BBWY.Client/Models/FinancialTerminal/ProcurementAudit/AuditPayBill.cs
index 897c0d33..dcb36285 100644
--- a/BBWY.Client/Models/FinancialTerminal/ProcurementAudit/AuditPayBill.cs
+++ b/BBWY.Client/Models/FinancialTerminal/ProcurementAudit/AuditPayBill.cs
@@ -91,6 +91,13 @@ namespace BBWY.Client.Models
}
}
+ public Platform? PurchasePlatform { get; set; }
+
+ ///
+ /// 导入时选择的店铺
+ ///
+ public string ImportShopIds { get; set; }
+
///
/// 错误信息
///
diff --git a/BBWY.Client/ViewModels/FinancialTerminal/ProcurementAuditViewModel.cs b/BBWY.Client/ViewModels/FinancialTerminal/ProcurementAuditViewModel.cs
index 610e14fb..b13483a5 100644
--- a/BBWY.Client/ViewModels/FinancialTerminal/ProcurementAuditViewModel.cs
+++ b/BBWY.Client/ViewModels/FinancialTerminal/ProcurementAuditViewModel.cs
@@ -27,6 +27,7 @@ namespace BBWY.Client.ViewModels
private bool isShowPayBillPanel;
private bool onlyException;
private PurchaseOrderService purchaseOrderService;
+ private FinancialTerminalService financialTerminalService;
private Department selectedDepartment;
private DateTime startDate;
private DateTime endDate;
@@ -34,7 +35,7 @@ namespace BBWY.Client.ViewModels
private bool noMatchPurchaseOrder;
private bool noChooseFundType;
private string searchResultPurchaseOrder;
-
+ private Platform? selectPurchasePlatform;
public Department SelectedDepartment
{
get => selectedDepartment; set
@@ -96,6 +97,10 @@ namespace BBWY.Client.ViewModels
public ICommand SearchHistoryCommand { get; set; }
public ICommand SearchLocalCommand { get; set; }
+ public ICommand ClearLocalConditionCommand { get; set; }
+
+ public ICommand SaveCommand { get; set; }
+
public Shop SelectResultShop { get => selectResultShop; set { Set(ref selectResultShop, value); } }
public bool NoMatchPurchaseOrder { get => noMatchPurchaseOrder; set { Set(ref noMatchPurchaseOrder, value); } }
@@ -103,7 +108,9 @@ namespace BBWY.Client.ViewModels
public string SearchResultPurchaseOrder { get => searchResultPurchaseOrder; set { Set(ref searchResultPurchaseOrder, value); } }
- public ProcurementAuditViewModel(PurchaseOrderService purchaseOrderService, GlobalContext globalContext)
+ public Platform? SelectPurchasePlatform { get => selectPurchasePlatform; set { Set(ref selectPurchasePlatform, value); } }
+
+ public ProcurementAuditViewModel(PurchaseOrderService purchaseOrderService, FinancialTerminalService financialTerminalService, GlobalContext globalContext)
{
this.globalContext = globalContext;
AuditFileList = new ObservableCollection();
@@ -112,7 +119,10 @@ namespace BBWY.Client.ViewModels
ImportAliPayBillCommand = new RelayCommand(ImportAliPayBill);
SearchHistoryCommand = new RelayCommand(SearchHistory);
SearchLocalCommand = new RelayCommand(SearchLocal);
+ ClearLocalConditionCommand = new RelayCommand(ClearLocalCondition);
+ SaveCommand = new RelayCommand(Save);
this.purchaseOrderService = purchaseOrderService;
+ this.financialTerminalService = financialTerminalService;
DepartmentList = new ObservableCollection();
AuditFileList = new ObservableCollection();
@@ -226,6 +236,7 @@ namespace BBWY.Client.ViewModels
payBill.RelationShopOrderId = relationPurchaseOrder.OrderId;
payBill.BelongShopId = relationPurchaseOrder.ShopId;
payBill.BelongShop = shopList.FirstOrDefault(s => s.ShopId == relationPurchaseOrder.ShopId)?.ShopName;
+ payBill.PurchasePlatform = relationPurchaseOrder.PurchasePlatform;
if (payBill.IncomeAmount > 0)
payBill.AuditCapitalType = AuditCapitalType.当月商品退款;
else
@@ -275,7 +286,9 @@ namespace BBWY.Client.ViewModels
//IsShowShopOrderPanel = false;
OnlyException = false;
SelectResultShop = null;
-
+ NoChooseFundType = false;
+ NoMatchPurchaseOrder = false;
+ SearchResultPurchaseOrder = string.Empty;
}
private (string ErrorMessage, string FileName, List Lines) ImportAuditFile(AuditFileType auditFileType)
@@ -389,6 +402,16 @@ namespace BBWY.Client.ViewModels
}
}
+ private void ClearLocalCondition()
+ {
+ OnlyException = false;
+ NoMatchPurchaseOrder = false;
+ NoChooseFundType = false;
+ SelectResultShop = null;
+ SelectPurchasePlatform = null;
+ SearchLocal();
+ }
+
///
/// 采购审计文件对象改变事件
///
@@ -409,12 +432,53 @@ namespace BBWY.Client.ViewModels
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 => b.RelationPurchaseOrderId == SearchResultPurchaseOrder);
+ 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()
+ {
+ if (ShowAuditPayBillList.Count == 0)
+ {
+ MessageBox.Show("没有需要保存的数据", "提示");
+ return;
+ }
+ var importShopIds = string.Join(',', SelectedDepartment.ShopList.Where(s => s.IsSelected).Select(s => s.ShopId));
+
+ var replaceResponse = financialTerminalService.IsExistAuditPayBill(importShopIds, StartDate, EndDate);
+ if (!replaceResponse.Success)
+ {
+ MessageBox.Show("检查重复账单失败", "提示");
+ return;
+ }
+
+ if (replaceResponse.Data)
+ if (MessageBox.Show("存在重复账单数据,是否覆盖", "确认", MessageBoxButton.OKCancel) != MessageBoxResult.OK)
+ return;
+
+ IsLoading = true;
+
+ foreach (var bill in ShowAuditPayBillList)
+ bill.ImportShopIds = importShopIds;
+
+ Task.Factory.StartNew(() => financialTerminalService.BatchInsertAuditPayBill(ShowAuditPayBillList)).ContinueWith(t =>
+ {
+ var insertResponse = t.Result;
+ App.Current.Dispatcher.Invoke(() =>
+ {
+ if (insertResponse.Success)
+ MessageBox.Show("保存成功", "提示");
+ else
+ MessageBox.Show(insertResponse.Msg, "提示");
+ });
+ });
+
+ }
}
}
diff --git a/BBWY.Client/Views/FinancialTerminal/ProcurementAudit.xaml b/BBWY.Client/Views/FinancialTerminal/ProcurementAudit.xaml
index d4539571..5f10cf9d 100644
--- a/BBWY.Client/Views/FinancialTerminal/ProcurementAudit.xaml
+++ b/BBWY.Client/Views/FinancialTerminal/ProcurementAudit.xaml
@@ -18,6 +18,11 @@
+
+
+
+
+
@@ -151,7 +156,10 @@
VerticalAlignment="Center" Height="25"/>
-
+
+
-
+
@@ -202,6 +211,7 @@
+
diff --git a/BBWY.Server.Model/Db/FinancialTerminal/AuditPayBill.cs b/BBWY.Server.Model/Db/FinancialTerminal/AuditPayBill.cs
index 4850e398..d2e65c15 100644
--- a/BBWY.Server.Model/Db/FinancialTerminal/AuditPayBill.cs
+++ b/BBWY.Server.Model/Db/FinancialTerminal/AuditPayBill.cs
@@ -104,6 +104,8 @@ namespace BBWY.Server.Model.Db
/// 导入时选择的店铺
///
public string ImportShopIds { get; set; }
+
+ public string ErrorMessage { get; set; }
}
}