From d4410ea3281f218474eb27d3620e75c07a8776d3 Mon Sep 17 00:00:00 2001 From: mmrbnjd Date: Thu, 4 Jul 2024 18:49:11 +0330 Subject: [PATCH] ... --- Back/Controllers/InvoiceController.cs | 24 +++++++++++++++---- .../Persistence/SqlDbContext.cs | 1 + Back/Data/Models/rptQueue.cs | 10 ++++++++ Back/appsettings.production.json | 3 ++- 4 files changed, 33 insertions(+), 5 deletions(-) create mode 100644 Back/Data/Models/rptQueue.cs diff --git a/Back/Controllers/InvoiceController.cs b/Back/Controllers/InvoiceController.cs index b58a145..00d1cea 100644 --- a/Back/Controllers/InvoiceController.cs +++ b/Back/Controllers/InvoiceController.cs @@ -1,4 +1,5 @@ using Back.Common; +using Back.Data.Contracts; using Back.Data.Models; using Back.Services; using Back.Validations; @@ -22,15 +23,18 @@ namespace Back.Controllers private readonly servUser _servUser; private readonly AddOrUpdateInvoiceValidation _validationInvoice; private readonly servTaxPayer _servTaxPayer; + private readonly IAsyncRepository _rptQueueRepository; public InvoiceController(servInvoice servInvoice, servUser servUser , AddOrUpdateInvoiceValidation validationInvoice - , servTaxPayer servTaxPayer, IConfiguration configuration) + , servTaxPayer servTaxPayer, IConfiguration configuration + , IAsyncRepository rptQueueRepository) { _servInvoice = servInvoice; _servUser = servUser; _validationInvoice = validationInvoice; _configuration=configuration; _servTaxPayer = servTaxPayer; + _rptQueueRepository = rptQueueRepository; } [HttpPost("GetAll")] @@ -458,7 +462,19 @@ namespace Back.Controllers if (!await _servInvoice.ExistInvoiceByInvoiceID(CompanyID.Value, InvoiceID)) return NotFound(); - + + //if( await _rptQueueRepository.AddBoolResultAsync(new rptQueue + // { + // CompanyID= CompanyID.Value,InvoicID= InvoiceID, + //})) + // { + // Thread.Sleep(2000); + // if(System.IO.File.Exists(_configuration["rptQueue"].ToString()+ InvoiceID + ".txt")) + // { + // output= System.IO.File.ReadAllText(_configuration["rptQueue"].ToString() + InvoiceID + ".txt"); + // } + + // } // Start the child process. Process p = new Process(); @@ -468,8 +484,8 @@ namespace Back.Controllers p.StartInfo.FileName = _configuration["CreateReportFileName"].ToString(); p.StartInfo.Arguments = $"{CompanyID} {InvoiceID}"; p.Start(); - output =await p.StandardOutput.ReadToEndAsync(); - await p.WaitForExitAsync(); + output = await p.StandardOutput.ReadToEndAsync(); + await p.WaitForExitAsync(); return Ok(output); } [HttpPut("SetExternalAccessCode/{InvoiceID}")] diff --git a/Back/Data/Infrastructure/Persistence/SqlDbContext.cs b/Back/Data/Infrastructure/Persistence/SqlDbContext.cs index 286cdc8..177be6b 100644 --- a/Back/Data/Infrastructure/Persistence/SqlDbContext.cs +++ b/Back/Data/Infrastructure/Persistence/SqlDbContext.cs @@ -46,6 +46,7 @@ namespace TaxPayer.Infrastructure.Persistence public DbSet UserNotifis { get; set; } public DbSet Stuffs { get; set; } public DbSet Ulrs { get; set; } + public DbSet rptQueue { get; set; } #endregion //public override Task SaveChangesAsync(CancellationToken cancellationToken = new CancellationToken()) //{ diff --git a/Back/Data/Models/rptQueue.cs b/Back/Data/Models/rptQueue.cs new file mode 100644 index 0000000..44ab099 --- /dev/null +++ b/Back/Data/Models/rptQueue.cs @@ -0,0 +1,10 @@ +namespace Back.Data.Models +{ + public class rptQueue + { + public int ID { get; set; } + public int InvoicID { get; set; } + public int CompanyID { get; set; } + + } +} diff --git a/Back/appsettings.production.json b/Back/appsettings.production.json index 7789554..0f9b00e 100644 --- a/Back/appsettings.production.json +++ b/Back/appsettings.production.json @@ -12,5 +12,6 @@ "Fixedvalues": { "Jwt_Lifetime_Minutes": "144000" }, - "CreateReportFileName": "E:\\CreateReport\\CreateReport.exe" + "CreateReportFileName": "E:\\CreateReport\\CreateReport.exe", + "rptQueue": "E:\\Report\\ResponseQueue" }