shanji 3 years ago
parent
commit
affb8ab12d
  1. 2
      BBWY.Client/Models/APIModel/Response/FinancialTerminal/AuditPayBillResponse.cs
  2. 7
      BBWY.Client/Models/FinancialTerminal/ProcurementAudit/AuditPayBill.cs
  3. 74
      BBWY.Client/ViewModels/FinancialTerminal/ProcurementAuditViewModel.cs
  4. 14
      BBWY.Client/Views/FinancialTerminal/ProcurementAudit.xaml
  5. 2
      BBWY.Server.Model/Db/FinancialTerminal/AuditPayBill.cs

2
BBWY.Client/Models/APIModel/Response/FinancialTerminal/AuditPayBillResponse.cs

@ -92,5 +92,7 @@ namespace BBWY.Client.Models
/// 导入时选择的店铺
/// </summary>
public string ImportShopIds { get; set; }
public string ErrorMessage { get; set; }
}
}

7
BBWY.Client/Models/FinancialTerminal/ProcurementAudit/AuditPayBill.cs

@ -91,6 +91,13 @@ namespace BBWY.Client.Models
}
}
public Platform? PurchasePlatform { get; set; }
/// <summary>
/// 导入时选择的店铺
/// </summary>
public string ImportShopIds { get; set; }
/// <summary>
/// 错误信息
/// </summary>

74
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<AuditFile>();
@ -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<Department>();
AuditFileList = new ObservableCollection<AuditFile>();
@ -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<string> 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();
}
/// <summary>
/// 采购审计文件对象改变事件
/// </summary>
@ -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, "提示");
});
});
}
}
}

14
BBWY.Client/Views/FinancialTerminal/ProcurementAudit.xaml

@ -18,6 +18,11 @@
<x:Type TypeName="cmodel:AuditCapitalType"/>
</ObjectDataProvider.MethodParameters>
</ObjectDataProvider>
<ObjectDataProvider x:Key="platformProvider" MethodName="GetValues" ObjectType="{x:Type sys:Enum}">
<ObjectDataProvider.MethodParameters>
<x:Type TypeName="cmodel:Platform"/>
</ObjectDataProvider.MethodParameters>
</ObjectDataProvider>
</Page.Resources>
<Grid>
<c:RoundWaitProgress Play="{Binding IsLoading}" Panel.ZIndex="999"/>
@ -151,7 +156,10 @@
VerticalAlignment="Center" Height="25"/>
<TextBlock Text="采购平台" VerticalAlignment="Center" Margin="5,0,0,0"/>
<ComboBox Width="100" Margin="5,0,0,0" Height="25"/>
<ComboBox Margin="5,0,0,0" Height="25"
ItemsSource="{Binding Source={StaticResource platformProvider}}"
SelectedItem="{Binding SelectPurchasePlatform,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
VerticalContentAlignment="Center"/>
<TextBlock Text="采购单号" VerticalAlignment="Center" Margin="5,0,0,0"/>
<c:BTextBox Width="100" Height="25" Margin="5,0,0,0"
@ -160,8 +168,9 @@
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
<c:BButton Content="结果搜索" Padding="10,0" Command="{Binding SearchLocalCommand}"/>
<c:BButton Content="清空条件" Padding="10,0" Command="{Binding ClearLocalConditionCommand}" Background="{StaticResource Text.Pink}"/>
<c:BButton Content="导出Excel" Padding="10,0" Background="#02A7F0"/>
<c:BButton Content="保存" Padding="10,0" Background="#1CC2A2"/>
<c:BButton Content="保存" Padding="10,0" Background="#1CC2A2" Command="{Binding SaveCommand}"/>
</StackPanel>
</Grid>
@ -202,6 +211,7 @@
<DataGridTextColumn Header="归属店铺" Width="100" Binding="{Binding BelongShop}" ElementStyle="{StaticResource verticalCenterTextBlock}"/>
<DataGridTextColumn Header="关联采购单" Width="140" Binding="{Binding RelationPurchaseOrderId}" ElementStyle="{StaticResource verticalCenterTextBlock}"/>
<DataGridTextColumn Header="关联销售单" Width="120" Binding="{Binding RelationShopOrderId}" ElementStyle="{StaticResource verticalCenterTextBlock}"/>
<DataGridTextColumn Header="采购平台" Width="60" Binding="{Binding PurchasePlatform}" ElementStyle="{StaticResource middleTextBlock}"/>
<DataGridTextColumn Header="备注" Width="*" Binding="{Binding Remark}" ElementStyle="{StaticResource verticalCenterTextBlock}"/>
<DataGridTextColumn Header="异常内容" Width="*" Binding="{Binding ErrorMessage}" Foreground="Red" ElementStyle="{StaticResource verticalCenterTextBlock}"/>
</DataGrid.Columns>

2
BBWY.Server.Model/Db/FinancialTerminal/AuditPayBill.cs

@ -104,6 +104,8 @@ namespace BBWY.Server.Model.Db
/// 导入时选择的店铺
/// </summary>
public string ImportShopIds { get; set; }
public string ErrorMessage { get; set; }
}
}

Loading…
Cancel
Save