diff --git a/ds-wms-service/DS.WMS.Core/Invoice/Interface/IInvoiceIssuanceService.cs b/ds-wms-service/DS.WMS.Core/Invoice/Interface/IInvoiceIssuanceService.cs index 0bc92c8e..26fe8383 100644 --- a/ds-wms-service/DS.WMS.Core/Invoice/Interface/IInvoiceIssuanceService.cs +++ b/ds-wms-service/DS.WMS.Core/Invoice/Interface/IInvoiceIssuanceService.cs @@ -18,9 +18,9 @@ namespace DS.WMS.Core.Invoice.Interface /// /// 更新发票号码 /// - /// 开票流水号 + /// /// - Task UpdateInvoiceNumberAsync(string sn); + Task UpdateInvoiceNumberAsync(long id); /// /// 发票冲红 diff --git a/ds-wms-service/DS.WMS.Core/Invoice/Method/InvoiceIssuanceService.cs b/ds-wms-service/DS.WMS.Core/Invoice/Method/InvoiceIssuanceService.cs index 41dbc0c5..9bf765f1 100644 --- a/ds-wms-service/DS.WMS.Core/Invoice/Method/InvoiceIssuanceService.cs +++ b/ds-wms-service/DS.WMS.Core/Invoice/Method/InvoiceIssuanceService.cs @@ -21,7 +21,7 @@ namespace DS.WMS.Core.Invoice.Method { //readonly InvoiceApiFox api; static readonly ApiFox api; - + static InvoiceIssuanceService() { api = new ApiFox(); @@ -34,7 +34,7 @@ namespace DS.WMS.Core.Invoice.Method public InvoiceIssuanceService(IServiceProvider provider) : base(provider) { var config = provider.GetRequiredService(); - + } /// @@ -134,9 +134,9 @@ namespace DS.WMS.Core.Invoice.Method var invoices = ids.Select(x => new Entity.Invoice { Id = x, SN = sn, ApiType = InvoiceApiType.Default }).ToList(); await TenantDb.Updateable(invoices).UpdateColumns(x => new { x.SN, x.ApiType }).ExecuteCommandAsync(); - UpdateInvoiceNumberAsync(sn); + await UpdateInvoiceNumberAsync(sn); - return DataResult.Success; + return DataResult.Successed("开票已提交", data: sn); } else { @@ -175,9 +175,9 @@ namespace DS.WMS.Core.Invoice.Method if (queryResult == null || !queryResult.Success) return DataResult.Failed(queryResult?.Message); + List invoices = []; if (queryResult.Data.Order?.Count > 0) { - List invoices = []; foreach (var item in queryResult.Data.Order) { var inv = new Entity.Invoice @@ -218,7 +218,24 @@ namespace DS.WMS.Core.Invoice.Method }).ExecuteCommandAsync(); } - return DataResult.Success; + var result2 = DataResult.Success; + result2.Data = invoices; + return result2; + } + + /// + /// 更新发票号码 + /// + /// + /// + public async Task UpdateInvoiceNumberAsync(long id) + { + var model = await TenantDb.Queryable().Where(x => x.Id == id) + .Select(x => new { x.Id, x.SN, x.SaleDeptId, x.ApiType }).FirstAsync(); + if (model == null) + return DataResult.FailedWithDesc(nameof(MultiLanguageConst.EmptyData)); + + return await UpdateInvoiceNumberAsync(model.SN); } /// @@ -242,7 +259,7 @@ namespace DS.WMS.Core.Invoice.Method api.DefaultHeaders.Add("USER_KEY", orgauthinfo.Key); api.DefaultHeaders.Add("USER_SECRET", orgauthinfo.Secret); var result = await api.PostAsync>(AppSetting.app(new string[] { "InvoiceApi", "BaseUrl" }) + "/api/Invoice/RedInvoicing", req); - + if (!result.Succeeded) return DataResult.Failed(result.Message, result.MultiCode); diff --git a/ds-wms-service/DS.WMS.FeeApi/Controllers/GeneralInvoiceController.cs b/ds-wms-service/DS.WMS.FeeApi/Controllers/GeneralInvoiceController.cs index ad81d787..dd7ed8f4 100644 --- a/ds-wms-service/DS.WMS.FeeApi/Controllers/GeneralInvoiceController.cs +++ b/ds-wms-service/DS.WMS.FeeApi/Controllers/GeneralInvoiceController.cs @@ -146,6 +146,18 @@ namespace DS.WMS.FeeApi.Controllers return await _service.SetLockAsync(isLocked, model.Ids); } + /// + /// 请求开票API查询发票状态 + /// + /// + /// + /// + [HttpPost, Route("ApiQuery")] + public async Task ApiQueryAsync([FromServices] IInvoiceIssuanceService issuanceService, long id) + { + return await issuanceService.UpdateInvoiceNumberAsync(id); + } + /// /// 发起开票请求 ///