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) + { + + } + + /// + /// 查询账单 + /// + /// + /// + /// + /// + public ApiResponse> GetAuditPayBillList(string importShopIds, DateTime startDate, DateTime endDate) + { + return SendRequest>(globalContext.BBYWApiHost, "Api/FinancialTerminal/GetAuditPayBillList", new + { + importShopIds, + startDate, + endDate + }, null, HttpMethod.Post); + } + + /// + /// 批量插入账单 + /// + /// + /// + public ApiResponse BatchInsertAuditPayBill(IList insertList) + { + return SendRequest(globalContext.BBYWApiHost, "Api/FinancialTerminal/BatchInsertAuditPayBill", insertList, null, HttpMethod.Post); + } + + /// + /// 检测账单是否存在 + /// + /// + /// + /// + /// + public ApiResponse IsExistAuditPayBill(string importShopIds, DateTime startDate, DateTime endDate) + { + return SendRequest(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 + { + /// + /// 账单流水号 + /// + public long PayBillNo { get; set; } + + /// + /// 归属店铺 + /// + public string BelongShop { get; set; } + + /// + /// 归属店铺Id + /// + + public int? BelongShopId { get; set; } + + public DateTime? CreateTime { get; set; } + + /// + /// 支出金额 + /// + public decimal? ExpenditureAmount { get; set; } + + /// + /// 收入金额 + /// + public decimal? IncomeAmount { get; set; } + + /// + /// 是否支持商户订单号 + /// + + public bool? IsSupportMerchantOrderNo { get; set; } + + /// + /// 格式化之后的商家订单号 + /// + + public string MerchantOrderNo { get; set; } + + /// + /// 对方账户 + /// + + public string OppositeAccount { get; set; } + + /// + /// 账单类型 + /// + public PayBillType? PayBillType { get; set; } + + /// + /// 支付时间 + /// + public DateTime? PayTime { get; set; } + + /// + /// 商品名称 + /// + + public string ProductName { get; set; } + + /// + /// 关联采购订单号 + /// + public string RelationPurchaseOrderId { get; set; } + + /// + /// 关联平台订单Id + /// + public string RelationShopOrderId { get; set; } + + /// + /// 备注 + /// + + public string Remark { get; set; } + + /// + /// 原始商家订单号 + /// + + public string SourceMerchantOrderNo { get; set; } + + /// + /// 导入时选择的店铺 + /// + 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 /// public decimal IncomeAmount { get; set; } - public long BelongShopId { get; set; } + public long? BelongShopId { get; set; } /// /// 归属店铺 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(); CreateMap(); CreateMap().ForMember(t => t.ProductItemNum, opt => opt.MapFrom(f => f.ProductNo)); - + CreateMap(); CreateMap().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(); @@ -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 Lines) ImportAuditFile(AuditFileType auditFileType) @@ -370,7 +392,7 @@ namespace BBWY.Client.ViewModels /// /// 采购审计文件对象改变事件 /// - 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 @@ - + @@ -64,9 +64,9 @@ - - - + + + @@ -76,86 +76,97 @@ - - + - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + - - - - + + - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + 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 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 /// /// 归属店铺Id /// - - 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 /// /// 账单类型 /// - [ Column(DbType = "int(1)")] - public int? PayBillType { get; set; } + [ Column(DbType = "int(1)",MapType = typeof(int?))] + public Enums.PayBillType? PayBillType { get; set; } /// /// 支付时间 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 } + + /// + /// 支付账单类型 + /// + public enum PayBillType + { + 支付宝 = 0, + 微信 = 1, + 银行卡 = 2 + } } }