From 5bd129d1c1ee63bf14ca740b8446734e01dbc7bf Mon Sep 17 00:00:00 2001
From: shanj <18996038927@163.com>
Date: Fri, 16 Sep 2022 02:48:11 +0800
Subject: [PATCH] 1

---
 .../APIServices/FinancialTerminalService.cs   |  61 +++++++
 .../FinancialTerminal/AuditPayBillResponse.cs |  96 +++++++++++
 .../ProcurementAudit/AuditPayBill.cs          |   2 +-
 BBWY.Client/Models/MappingProfile.cs          |   2 +-
 .../ProcurementAuditViewModel.cs              |  53 +++++--
 .../FinancialTerminal/ProcurementAudit.xaml   | 149 ++++++++++--------
 .../FinancialTerminalBusiness.cs              |   2 +
 .../Db/FinancialTerminal/AuditPayBill.cs      |   7 +-
 BBWY.Server.Model/Enums.cs                    |  10 ++
 9 files changed, 291 insertions(+), 91 deletions(-)
 create mode 100644 BBWY.Client/APIServices/FinancialTerminalService.cs
 create mode 100644 BBWY.Client/Models/APIModel/Response/FinancialTerminal/AuditPayBillResponse.cs

diff --git a/BBWY.Client/APIServices/FinancialTerminalService.cs b/BBWY.Client/APIServices/FinancialTerminalService.cs
new file mode 100644
index 00000000..3f9967f0
--- /dev/null
+++ b/BBWY.Client/APIServices/FinancialTerminalService.cs
@@ -0,0 +1,61 @@
+using BBWY.Client.Models;
+using BBWY.Common.Http;
+using BBWY.Common.Models;
+using System;
+using System.Collections.Generic;
+using System.Net.Http;
+
+namespace BBWY.Client.APIServices
+{
+    public class FinancialTerminalService : BaseApiService, IDenpendency
+    {
+        public FinancialTerminalService(RestApiService restApiService, GlobalContext globalContext) : base(restApiService, globalContext)
+        {
+
+        }
+
+        /// <summary>
+        /// 查询账单
+        /// </summary>
+        /// <param name="importShopIds"></param>
+        /// <param name="startDate"></param>
+        /// <param name="endDate"></param>
+        /// <returns></returns>
+        public ApiResponse<IList<AuditPayBillResponse>> GetAuditPayBillList(string importShopIds, DateTime startDate, DateTime endDate)
+        {
+            return SendRequest<IList<AuditPayBillResponse>>(globalContext.BBYWApiHost, "Api/FinancialTerminal/GetAuditPayBillList", new
+            {
+                importShopIds,
+                startDate,
+                endDate
+            }, null, HttpMethod.Post);
+        }
+
+        /// <summary>
+        /// 批量插入账单
+        /// </summary>
+        /// <param name="insertList"></param>
+        /// <returns></returns>
+        public ApiResponse<object> BatchInsertAuditPayBill(IList<AuditPayBill> insertList)
+        {
+            return SendRequest<object>(globalContext.BBYWApiHost, "Api/FinancialTerminal/BatchInsertAuditPayBill", insertList, null, HttpMethod.Post);
+        }
+
+        /// <summary>
+        /// 检测账单是否存在
+        /// </summary>
+        /// <param name="importShopIds"></param>
+        /// <param name="startDate"></param>
+        /// <param name="endDate"></param>
+        /// <returns></returns>
+        public ApiResponse<bool> IsExistAuditPayBill(string importShopIds, DateTime startDate, DateTime endDate)
+        {
+            return SendRequest<bool>(globalContext.BBYWApiHost, "Api/FinancialTerminal/IsExistAuditPayBill", new
+            {
+                importShopIds,
+                startDate,
+                endDate
+            }, null, HttpMethod.Post);
+        }
+    }
+}
diff --git a/BBWY.Client/Models/APIModel/Response/FinancialTerminal/AuditPayBillResponse.cs b/BBWY.Client/Models/APIModel/Response/FinancialTerminal/AuditPayBillResponse.cs
new file mode 100644
index 00000000..919983c2
--- /dev/null
+++ b/BBWY.Client/Models/APIModel/Response/FinancialTerminal/AuditPayBillResponse.cs
@@ -0,0 +1,96 @@
+using System;
+
+namespace BBWY.Client.Models
+{
+    public class AuditPayBillResponse
+    {
+		/// <summary>
+		/// 账单流水号
+		/// </summary>
+		public long PayBillNo { get; set; }
+
+		/// <summary>
+		/// 归属店铺
+		/// </summary>
+		public string BelongShop { get; set; }
+
+		/// <summary>
+		/// 归属店铺Id
+		/// </summary>
+
+		public int? BelongShopId { get; set; }
+
+		public DateTime? CreateTime { get; set; }
+
+		/// <summary>
+		/// 支出金额
+		/// </summary>
+		public decimal? ExpenditureAmount { get; set; }
+
+		/// <summary>
+		/// 收入金额
+		/// </summary>
+		public decimal? IncomeAmount { get; set; }
+
+		/// <summary>
+		/// 是否支持商户订单号
+		/// </summary>
+
+		public bool? IsSupportMerchantOrderNo { get; set; }
+
+		/// <summary>
+		/// 格式化之后的商家订单号
+		/// </summary>
+
+		public string MerchantOrderNo { get; set; }
+
+		/// <summary>
+		/// 对方账户
+		/// </summary>
+
+		public string OppositeAccount { get; set; }
+
+		/// <summary>
+		/// 账单类型
+		/// </summary>
+		public PayBillType? PayBillType { get; set; }
+
+		/// <summary>
+		/// 支付时间
+		/// </summary>
+		public DateTime? PayTime { get; set; }
+
+		/// <summary>
+		/// 商品名称
+		/// </summary>
+
+		public string ProductName { get; set; }
+
+		/// <summary>
+		/// 关联采购订单号
+		/// </summary>
+		public string RelationPurchaseOrderId { get; set; }
+
+		/// <summary>
+		/// 关联平台订单Id
+		/// </summary>
+		public string RelationShopOrderId { get; set; }
+
+		/// <summary>
+		/// 备注
+		/// </summary>
+
+		public string Remark { get; set; }
+
+		/// <summary>
+		/// 原始商家订单号
+		/// </summary>
+
+		public string SourceMerchantOrderNo { get; set; }
+
+		/// <summary>
+		/// 导入时选择的店铺
+		/// </summary>
+		public string ImportShopIds { get; set; }
+	}
+}
diff --git a/BBWY.Client/Models/FinancialTerminal/ProcurementAudit/AuditPayBill.cs b/BBWY.Client/Models/FinancialTerminal/ProcurementAudit/AuditPayBill.cs
index 100e4df2..897c0d33 100644
--- a/BBWY.Client/Models/FinancialTerminal/ProcurementAudit/AuditPayBill.cs
+++ b/BBWY.Client/Models/FinancialTerminal/ProcurementAudit/AuditPayBill.cs
@@ -56,7 +56,7 @@ namespace BBWY.Client.Models
         /// </summary>
         public decimal IncomeAmount { get; set; }
 
-        public long BelongShopId { get; set; }
+        public long? BelongShopId { get; set; }
 
         /// <summary>
         /// 归属店铺
diff --git a/BBWY.Client/Models/MappingProfile.cs b/BBWY.Client/Models/MappingProfile.cs
index d1d9da35..20eb37d1 100644
--- a/BBWY.Client/Models/MappingProfile.cs
+++ b/BBWY.Client/Models/MappingProfile.cs
@@ -14,7 +14,7 @@ namespace BBWY.Client.Models
             CreateMap<AfterSaleOrderResponse, AfterSaleOrder>();
             CreateMap<OrderResponse, Order>();
             CreateMap<OrderSkuResponse, OrderSku>().ForMember(t => t.ProductItemNum, opt => opt.MapFrom(f => f.ProductNo));
-
+            CreateMap<AuditPayBillResponse, AuditPayBill>();
             CreateMap<MDSUserResponse, User>().ForMember(t => t.TeamId, opt => opt.MapFrom(f => f.DepartmentId))
                                               .ForMember(t => t.TeamName, opt => opt.MapFrom(f => f.DepartmentName))
                                               .ForMember(t => t.Name, opt => opt.MapFrom(f => f.UserName));
diff --git a/BBWY.Client/ViewModels/FinancialTerminal/ProcurementAuditViewModel.cs b/BBWY.Client/ViewModels/FinancialTerminal/ProcurementAuditViewModel.cs
index dfc71899..610e14fb 100644
--- a/BBWY.Client/ViewModels/FinancialTerminal/ProcurementAuditViewModel.cs
+++ b/BBWY.Client/ViewModels/FinancialTerminal/ProcurementAuditViewModel.cs
@@ -30,6 +30,11 @@ namespace BBWY.Client.ViewModels
         private Department selectedDepartment;
         private DateTime startDate;
         private DateTime endDate;
+        private Shop selectResultShop;
+        private bool noMatchPurchaseOrder;
+        private bool noChooseFundType;
+        private string searchResultPurchaseOrder;
+
         public Department SelectedDepartment
         {
             get => selectedDepartment; set
@@ -58,7 +63,7 @@ namespace BBWY.Client.ViewModels
             get => selectAuditFile; set
             {
                 if (Set(ref selectAuditFile, value))
-                    OnSelectAuditFileChanged();
+                    SearchLocal();
             }
         }
 
@@ -75,11 +80,7 @@ namespace BBWY.Client.ViewModels
 
         public bool OnlyException
         {
-            get => onlyException; set
-            {
-                if (Set(ref onlyException, value))
-                    OnOnlyExceptionChanged();
-            }
+            get => onlyException; set { Set(ref onlyException, value); }
         }
 
         public ICommand AuditCommand { get; set; }
@@ -92,6 +93,16 @@ namespace BBWY.Client.ViewModels
 
         public ICommand ImportJDShopOrderCommand { get; set; }
 
+        public ICommand SearchHistoryCommand { get; set; }
+
+        public ICommand SearchLocalCommand { get; set; }
+        public Shop SelectResultShop { get => selectResultShop; set { Set(ref selectResultShop, value); } }
+
+        public bool NoMatchPurchaseOrder { get => noMatchPurchaseOrder; set { Set(ref noMatchPurchaseOrder, value); } }
+        public bool NoChooseFundType { get => noChooseFundType; set { Set(ref noChooseFundType, value); } }
+
+        public string SearchResultPurchaseOrder { get => searchResultPurchaseOrder; set { Set(ref searchResultPurchaseOrder, value); } }
+
         public ProcurementAuditViewModel(PurchaseOrderService purchaseOrderService, GlobalContext globalContext)
         {
             this.globalContext = globalContext;
@@ -99,6 +110,8 @@ namespace BBWY.Client.ViewModels
             AuditCommand = new RelayCommand(Audit);
             ClearAuditCommand = new RelayCommand(ClearAudit);
             ImportAliPayBillCommand = new RelayCommand(ImportAliPayBill);
+            SearchHistoryCommand = new RelayCommand(SearchHistory);
+            SearchLocalCommand = new RelayCommand(SearchLocal);
             this.purchaseOrderService = purchaseOrderService;
 
             DepartmentList = new ObservableCollection<Department>();
@@ -117,6 +130,13 @@ namespace BBWY.Client.ViewModels
             SelectedDepartment = DepartmentList[0];
         }
 
+        private void SearchHistory()
+        {
+            if (IsLoading)
+                return;
+
+        }
+
         private void Audit()
         {
             if (IsLoading)
@@ -254,6 +274,8 @@ namespace BBWY.Client.ViewModels
             //IsShowPurchaseOrderPanel = false;
             //IsShowShopOrderPanel = false;
             OnlyException = false;
+            SelectResultShop = null;
+
         }
 
         private (string ErrorMessage, string FileName, List<string> Lines) ImportAuditFile(AuditFileType auditFileType)
@@ -370,7 +392,7 @@ namespace BBWY.Client.ViewModels
         /// <summary>
         /// 采购审计文件对象改变事件
         /// </summary>
-        private void OnSelectAuditFileChanged()
+        private void SearchLocal()
         {
             if (SelectAuditFile == null)
                 return;
@@ -381,19 +403,18 @@ namespace BBWY.Client.ViewModels
                 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 => b.RelationPurchaseOrderId == SearchResultPurchaseOrder);
                 var list = where.ToList();
                 foreach (var b in list)
                     ShowAuditPayBillList.Add(b);
             }
         }
-
-        private void OnOnlyExceptionChanged()
-        {
-            if (SelectAuditFile == null || AuditFileList.Count() == 0)
-                return;
-            var f = SelectAuditFile;
-            SelectAuditFile = null;
-            SelectAuditFile = f;
-        }
     }
 }
diff --git a/BBWY.Client/Views/FinancialTerminal/ProcurementAudit.xaml b/BBWY.Client/Views/FinancialTerminal/ProcurementAudit.xaml
index 1a9a06e9..d4539571 100644
--- a/BBWY.Client/Views/FinancialTerminal/ProcurementAudit.xaml
+++ b/BBWY.Client/Views/FinancialTerminal/ProcurementAudit.xaml
@@ -25,7 +25,7 @@
             <Grid.RowDefinitions>
                 <RowDefinition Height="40"/>
                 <RowDefinition Height="5"/>
-                <RowDefinition Height="auto"/>
+                <RowDefinition Height="30"/>
                 <RowDefinition Height="5"/>
                 <RowDefinition Height="30"/>
                 <RowDefinition Height="5"/>
@@ -64,9 +64,9 @@
                     </hc:CheckComboBox>
                     <DatePicker Width="100" Height="30" Margin="5,0,0,0" SelectedDate="{Binding StartDate,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"/>
                     <DatePicker Width="100" Height="30" Margin="5,0,0,0" SelectedDate="{Binding EndDate,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"/>
-                    <c:BButton Content="查询" Margin="5,0,0,0" Padding="10,0" Command="{Binding AuditCommand}"/>
-                    <c:BButton Content="审计" Margin="5,0,0,0" Padding="10,0" Command="{Binding AuditCommand}"/>
-                    <c:BButton Content="清空" Margin="5,0,0,0" Padding="10,0" Command="{Binding ClearAuditCommand}"/>
+                    <c:BButton Content="查询" Margin="5,0,0,0" Padding="10,0" Command="{Binding SearchHistoryCommand}"/>
+                    <c:BButton Content="审计" Padding="10,0" Command="{Binding AuditCommand}" Background="#02A7F0"/>
+                    <c:BButton Content="清空" Padding="10,0" Command="{Binding ClearAuditCommand}" Background="#1CC2A2"/>
                 </StackPanel>
             </Border>
 
@@ -76,86 +76,97 @@
                     <RowDefinition Height="40"/>
                 </Grid.RowDefinitions>
                 <Grid.ColumnDefinitions>
-                    <ColumnDefinition/>
-                    <ColumnDefinition/>
+                    <ColumnDefinition Width="Auto"/>
                     <ColumnDefinition/>
                 </Grid.ColumnDefinitions>
-                <TextBlock Text="支付数据" Visibility="Collapsed"/>
-                <TextBlock Text="采购数据" Grid.Column="1" Visibility="Collapsed"/>
-                <TextBlock Text="销售数据" Grid.Column="2" Visibility="Collapsed"/>
 
-                <Border Background="{StaticResource Border.Background}" Grid.Row="1" Grid.ColumnSpan="3" Margin="0,0,5,0">
+                <Border>
                     <StackPanel Orientation="Horizontal">
                         <c:BButton Content="导入支付宝账单" Padding="10,0" Margin="5,0,0,0" Command="{Binding ImportAliPayBillCommand}"/>
                         <c:BButton Content="导入微信账单" Padding="10,0" Margin="5,0,0,0" 
                                    IsEnabled="False" DisableText="{Binding Content,RelativeSource={RelativeSource Mode=Self}}"/>
                     </StackPanel>
                 </Border>
-
-                <Border Background="{StaticResource Border.Background}" Grid.Row="1" Grid.Column="1" Margin="0,0,5,0" Visibility="Collapsed">
-                    <StackPanel Orientation="Horizontal">
-                        <c:BButton Content="导入1688采购单" Padding="10,0" Margin="5,0,0,0" Command="{Binding Import1688PurchaseOrderCommand}"/>
-                        <c:BButton Content="导入淘宝采购单" Padding="10,0" Margin="5,0,0,0" 
-                                   IsEnabled="False" DisableText="{Binding Content,RelativeSource={RelativeSource Mode=Self}}"/>
-                        <c:BButton Content="导入拼多多采购单" Padding="10,0" Margin="5,0,0,0" 
-                                   IsEnabled="False" DisableText="{Binding Content,RelativeSource={RelativeSource Mode=Self}}"/>
-                    </StackPanel>
-                </Border>
-
-                <Border Background="{StaticResource Border.Background}" Grid.Row="1" Grid.Column="2" Visibility="Collapsed">
-                    <StackPanel Orientation="Horizontal">
-                        <c:BButton Content="后台出单表(京东)" Padding="10,0" Margin="5,0,0,0" Command="{Binding ImportJDShopOrderCommand}"/>
-                        <c:BButton Content="后台出单表(淘宝)" Padding="10,0" Margin="5,0,0,0" 
-                                   IsEnabled="False" DisableText="{Binding Content,RelativeSource={RelativeSource Mode=Self}}"/>
-                        <c:BButton Content="后台出单表(拼多多)" Padding="10,0" Margin="5,0,0,0" 
-                                   IsEnabled="False" DisableText="{Binding Content,RelativeSource={RelativeSource Mode=Self}}"/>
-                    </StackPanel>
-                </Border>
-            </Grid>
-
-            <ListBox ItemsSource="{Binding AuditFileList}"
-                     SelectedItem="{Binding SelectAuditFile,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
-                     Grid.Row="4"
-                     IsEnabled="{Binding IsAudited,Mode=OneWay,UpdateSourceTrigger=PropertyChanged}">
-                <ListBox.ItemContainerStyle>
-                    <Style TargetType="ListBoxItem" BasedOn="{StaticResource NoBgListBoxItemStyle}">
-                        <Style.Triggers>
-                            <DataTrigger Binding="{Binding AuditFileType}" Value="销售订单">
-                                <Setter Property="IsEnabled" Value="False"/>
-                            </DataTrigger>
-                        </Style.Triggers>
-                    </Style>
-                </ListBox.ItemContainerStyle>
-                <ListBox.ItemsPanel>
-                    <ItemsPanelTemplate>
-                        <StackPanel Orientation="Horizontal"/>
-                    </ItemsPanelTemplate>
-                </ListBox.ItemsPanel>
-                <ListBox.ItemTemplate>
-                    <DataTemplate>
-                        <Border BorderThickness="1" 
+                <ListBox ItemsSource="{Binding AuditFileList}"
+                         SelectedItem="{Binding SelectAuditFile,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
+                         Grid.Column="1"
+                         IsEnabled="{Binding IsAudited,Mode=OneWay,UpdateSourceTrigger=PropertyChanged}"
+                         Margin="5,0,0,0">
+                    <ListBox.ItemContainerStyle>
+                        <Style TargetType="ListBoxItem" BasedOn="{StaticResource NoBgListBoxItemStyle}">
+                            <Style.Triggers>
+                                <DataTrigger Binding="{Binding AuditFileType}" Value="销售订单">
+                                    <Setter Property="IsEnabled" Value="False"/>
+                                </DataTrigger>
+                            </Style.Triggers>
+                        </Style>
+                    </ListBox.ItemContainerStyle>
+                    <ListBox.ItemsPanel>
+                        <ItemsPanelTemplate>
+                            <StackPanel Orientation="Horizontal"/>
+                        </ItemsPanelTemplate>
+                    </ListBox.ItemsPanel>
+                    <ListBox.ItemTemplate>
+                        <DataTemplate>
+                            <Border BorderThickness="1" 
                                 BorderBrush="{StaticResource Border.Brush}"
                                 Height="30"
                                 Padding="5,0"
                                 Margin="0,0,-1,0">
-                            <TextBlock x:Name="txtFileName" Text="{Binding FileName}"
+                                <TextBlock x:Name="txtFileName" Text="{Binding FileName}"
                                        VerticalAlignment="Center"/>
-                        </Border>
-                        <DataTemplate.Triggers>
-                            <DataTrigger Binding="{Binding IsSelected,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type ListBoxItem}}}"
+                            </Border>
+                            <DataTemplate.Triggers>
+                                <DataTrigger Binding="{Binding IsSelected,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type ListBoxItem}}}"
                                          Value="True">
-                                <DataTrigger.Setters>
-                                    <Setter TargetName="txtFileName" Property="Foreground" Value="{StaticResource Text.Link.Color }"/>
-                                </DataTrigger.Setters>
-                            </DataTrigger>
-                        </DataTemplate.Triggers>
-                    </DataTemplate>
-                </ListBox.ItemTemplate>
-            </ListBox>
+                                    <DataTrigger.Setters>
+                                        <Setter TargetName="txtFileName" Property="Foreground" Value="{StaticResource Text.Link.Color }"/>
+                                    </DataTrigger.Setters>
+                                </DataTrigger>
+                            </DataTemplate.Triggers>
+                        </DataTemplate>
+                    </ListBox.ItemTemplate>
+                </ListBox>
+
+            </Grid>
+
+            <Grid Grid.Row="4">
+                <StackPanel Orientation="Horizontal">
+                    <CheckBox Content="仅显示异常"
+                              IsChecked="{Binding OnlyException,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
+                              FocusVisualStyle="{x:Null}"/>
+
+                    <CheckBox Content="未匹配采购单"
+                              IsChecked="{Binding NoMatchPurchaseOrder,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
+                              FocusVisualStyle="{x:Null}" Margin="5,0,0,0"/>
+
+                    <CheckBox Content="未选资金类型"
+                              IsChecked="{Binding NoChooseFundType,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
+                              FocusVisualStyle="{x:Null}" Margin="5,0,0,0"/>
+
+                    <TextBlock Text="店铺名称" VerticalAlignment="Center" Margin="5,0,0,0"/>
+                    <ComboBox Margin="5,0,0,0" ItemsSource="{Binding SelectedDepartment.ShopList}"
+                              SelectedItem="{Binding SelectResultShop,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
+                              VerticalContentAlignment="Center"
+                              VerticalAlignment="Center" Height="25"/>
+
+                    <TextBlock Text="采购平台" VerticalAlignment="Center" Margin="5,0,0,0"/>
+                    <ComboBox Width="100" Margin="5,0,0,0" Height="25"/>
+
+                    <TextBlock Text="采购单号" VerticalAlignment="Center" Margin="5,0,0,0"/>
+                    <c:BTextBox Width="100" Height="25" Margin="5,0,0,0"
+                                Text="{Binding SearchResultPurchaseOrder,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"/>
+                </StackPanel>
+
+                <StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
+                    <c:BButton Content="结果搜索" Padding="10,0" Command="{Binding SearchLocalCommand}"/>
+                    <c:BButton Content="导出Excel" Padding="10,0" Background="#02A7F0"/>
+                    <c:BButton Content="保存" Padding="10,0" Background="#1CC2A2"/>
+                </StackPanel>
+            </Grid>
+
+
 
-            <CheckBox Content="仅显示异常" Grid.Row="6"
-                      IsChecked="{Binding OnlyException,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
-                      FocusVisualStyle="{x:Null}"/>
             <DataGrid ItemsSource="{Binding ShowAuditPayBillList}"
                       Grid.Row="7"
                       Visibility="{Binding IsShowPayBillPanel,Converter={StaticResource objConverter},ConverterParameter=true:Visible:Collapsed}"
@@ -187,7 +198,7 @@
                         </DataGridTemplateColumn.CellTemplate>
                     </DataGridTemplateColumn>
                     <!--<DataGridTextColumn Header="商户订单号" Width="200" Binding="{Binding SourceMerchantOrderNo}" ElementStyle="{StaticResource verticalCenterTextBlock}"/>-->
-                   
+
                     <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}"/>
diff --git a/BBWY.Server.Business/FinancialTerminal/FinancialTerminalBusiness.cs b/BBWY.Server.Business/FinancialTerminal/FinancialTerminalBusiness.cs
index b9c130c6..0b83cb86 100644
--- a/BBWY.Server.Business/FinancialTerminal/FinancialTerminalBusiness.cs
+++ b/BBWY.Server.Business/FinancialTerminal/FinancialTerminalBusiness.cs
@@ -32,6 +32,8 @@ namespace BBWY.Server.Business
 
         public void BatchInsertAuditPayBill(List<AuditPayBill> insertList)
         {
+            if (insertList == null || insertList.Count == 0)
+                throw new BusinessException("数据不全");
             var importShopIds = insertList[0].ImportShopIds;
             var startTime = insertList.Min(abp => abp.PayTime).Value;
             var endTime = insertList.Max(abp => abp.PayTime).Value;
diff --git a/BBWY.Server.Model/Db/FinancialTerminal/AuditPayBill.cs b/BBWY.Server.Model/Db/FinancialTerminal/AuditPayBill.cs
index 08d148a3..4850e398 100644
--- a/BBWY.Server.Model/Db/FinancialTerminal/AuditPayBill.cs
+++ b/BBWY.Server.Model/Db/FinancialTerminal/AuditPayBill.cs
@@ -23,8 +23,7 @@ namespace BBWY.Server.Model.Db
 		/// <summary>
 		/// 归属店铺Id
 		/// </summary>
-		
-		public int? BelongShopId { get; set; }
+		public long? BelongShopId { get; set; }
 
 		[ Column(DbType = "datetime")]
 		public DateTime? CreateTime { get; set; }
@@ -62,8 +61,8 @@ namespace BBWY.Server.Model.Db
 		/// <summary>
 		/// 账单类型
 		/// </summary>
-		[ Column(DbType = "int(1)")]
-		public int? PayBillType { get; set; }
+		[ Column(DbType = "int(1)",MapType = typeof(int?))]
+		public Enums.PayBillType? PayBillType { get; set; }
 
 		/// <summary>
 		/// 支付时间
diff --git a/BBWY.Server.Model/Enums.cs b/BBWY.Server.Model/Enums.cs
index ffd28f66..285109e6 100644
--- a/BBWY.Server.Model/Enums.cs
+++ b/BBWY.Server.Model/Enums.cs
@@ -157,5 +157,15 @@
         {
             ModifyTime = 0, StartTime = 1
         }
+
+        /// <summary>
+        /// 支付账单类型
+        /// </summary>
+        public enum PayBillType
+        {
+            支付宝 = 0,
+            微信 = 1,
+            银行卡 = 2
+        }
     }
 }