This commit is contained in:
mmrbnjd
2024-07-08 16:10:06 +03:30
parent 9002305d5c
commit 488f2257f7
4 changed files with 15 additions and 99 deletions

View File

@@ -221,25 +221,17 @@ namespace Back.Controllers
{
case 1:
return Ok(await _servInvoice.ChangeInvoiceType(Invoice, InvoiceType.Sale));
case 3:
return Ok(await _servInvoice.ChangeInvoiceType(Invoice, InvoiceType.Cancellation));
//case 0:
// return Ok(await _servInvoice.ChangeInvoiceType(Invoice, InvoiceType.CANCEL));
default:
return BadRequest(new List<string> { $"تغییر وضعیت از {Invoice.invoiceType.GetEnumDisplayName()} به {((InvoiceType)invoiceType).GetEnumDisplayName()} امکان پذیر نیست" });
}
}
if (Invoice.invoiceType == InvoiceType.Sale)
{
//if (sent)
//{
switch (invoiceType)
{
//case 0:
// return Ok(await _servInvoice.ChangeInvoiceType(Invoice, InvoiceType.CANCEL));
case 3:
return Ok(await _servInvoice.ChangeInvoiceType(Invoice, InvoiceType.Cancellation));
@@ -305,53 +297,9 @@ namespace Back.Controllers
default:
return BadRequest(new List<string> { $"تغییر وضعیت از {Invoice.invoiceType.GetEnumDisplayName()} به {((InvoiceType)invoiceType).GetEnumDisplayName()} امکان پذیر نیست این صورتحساب به سامانه مودیان ارسال شده" });
}
//}
//else
//{
// switch (invoiceType)
// {
// case 0:
// return Ok(await _servInvoice.ChangeInvoiceType(Invoice, InvoiceType.CANCEL));
// default:
// return BadRequest(new List<string> { $"تغییر وضعیت از {Invoice.invoiceType.GetEnumDisplayName()} به {((InvoiceType)invoiceType).GetEnumDisplayName()} امکان پذیر نیست" });
// }
//}
}
//if (Invoice.invoiceType == InvoiceType.Cancellation)
//{
// if (!sent)
// {
// switch (invoiceType)
// {
// //case InvoiceType.Sale:
// // return Ok(await _servInvoice.ChangeInvoiceType(Invoice, invoiceType));
// case 0:
// return Ok(await _servInvoice.ChangeInvoiceType(Invoice, InvoiceType.CANCEL));
// default:
// return BadRequest(new List<string> { $"تغییر وضعیت از {Invoice.invoiceType.GetEnumDisplayName()} به {((InvoiceType)invoiceType).GetEnumDisplayName()} امکان پذیر نیست" });
// }
// }
// else return BadRequest(new List<string> { $"تغییر وضعیت از {Invoice.invoiceType.GetEnumDisplayName()} به {((InvoiceType)invoiceType).GetEnumDisplayName()} امکان پذیر نیست این صورتحساب به سامانه مودیان ارسال شده" });
//}
if (Invoice.invoiceType == InvoiceType.Repair)
{
//if (!sent)
//{
// switch (invoiceType)
// {
// case 0:
// return Ok(await _servInvoice.ChangeInvoiceType(Invoice, InvoiceType.CANCEL));
// default:
// return BadRequest(new List<string> { $"تغییر وضعیت از {Invoice.invoiceType.GetEnumDisplayName()} به {((InvoiceType)invoiceType).GetEnumDisplayName()} امکان پذیر نیست" });
// }
//}
//else
//{
switch (invoiceType)
{
case 3:
@@ -391,53 +339,16 @@ namespace Back.Controllers
return BadRequest(new List<string> { $"تغییر وضعیت از {Invoice.invoiceType.GetEnumDisplayName()} به {((InvoiceType)invoiceType).GetEnumDisplayName()} امکان پذیر نیست این صورتحساب به سامانه مودیان ارسال شده" });
}
//}
}
if (Invoice.invoiceType == InvoiceType.BackFrmSale)
{
// if (!sent)
// {
switch (invoiceType)
{
//case 0:
// return Ok(await _servInvoice.ChangeInvoiceType(Invoice, InvoiceType.CANCEL));
case 3:
return Ok(await _servInvoice.ChangeInvoiceType(Invoice, InvoiceType.Cancellation));
default:
return BadRequest(new List<string> { $"تغییر وضعیت از {Invoice.invoiceType.GetEnumDisplayName()} به {((InvoiceType)invoiceType).GetEnumDisplayName()} امکان پذیر نیست" });
}
// }
//else
//{
// switch (invoiceType)
// {
// case 3:
// return Ok(await _servInvoice.ChangeInvoiceType(Invoice, InvoiceType.Cancellation));
// //case InvoiceType.Repair:
// // await _servInvoice.ChangeInvoiceType(Invoice, invoiceType, false);
// // return Ok(await _servInvoice.AddInvoice(new Invoice()
// // {
// // Title = Invoice.Title,
// // Des = Invoice.Des,
// // invoiceType = invoiceType,
// // CustomerID = Invoice.CustomerID,
// // CompanyID = Invoice.CompanyID,
// // InvoicIssueDate = Invoice.InvoicIssueDate.Replace("/", ""),
// // InvoiceDate = Invoice.InvoicIssueDate.Replace("/", ""),
// // LastChangeUserID = Convert.ToInt32(UserID),
// // BillReference = Invoice.ID,
// // IsDeleted = false,
// // PatternID = Invoice.PatternID
// // }, false));
// default:
// return BadRequest(new List<string> { $"تغییر وضعیت از {Invoice.invoiceType.GetEnumDisplayName()} به {((InvoiceType)invoiceType).GetEnumDisplayName()} امکان پذیر نیست این صورتحساب به سامانه مودیان ارسال شده" });
// }
//}
}

View File

@@ -14,6 +14,7 @@ using Shared.DTOs.Serch;
using System;
using System.Security.Cryptography;
using TaxCollectData.Library.Dto.Content;
using TaxCollectData.Library.Dto.Transfer;
using static Shared.DTOs._TaxPayer;
using static System.Collections.Specialized.BitVector32;
@@ -86,11 +87,11 @@ namespace Back.Controllers
public async Task<ActionResult<bool>> CheckAuth()
{
var claim = HttpContext.User.Claims.First(c => c.Type == "UserID");
var UserID = claim.Value;
var user = await _servUser.GetUserByUserID(Convert.ToInt32(UserID));
if (await _actionTaxPayer.login(user.RolUsers.First().CompanyID))
return Ok();
//var claim = HttpContext.User.Claims.First(c => c.Type == "UserID");
//var UserID = claim.Value;
//var user = await _servUser.GetUserByUserID(Convert.ToInt32(UserID));
// return Ok(await _actionTaxPayer.login(user.RolUsers.First().CompanyID));
return Ok(true);
return BadRequest();
@@ -102,8 +103,8 @@ namespace Back.Controllers
var claim = HttpContext.User.Claims.First(c => c.Type == "UserID");
var UserID = claim.Value;
var user = await _servUser.GetUserByUserID(Convert.ToInt32(UserID));
if (!await _actionTaxPayer.login(user.RolUsers.First().CompanyID))
return BadRequest(new List<string> { "خطا در احراز هویت سازمان مالیاتی" });
//if (!await _actionTaxPayer.login(user.RolUsers.First().CompanyID))
// return BadRequest(new List<string> { "خطا در احراز هویت سازمان مالیاتی" });
var result = await _servTaxPayer.GetInvoice(user.RolUsers.First().CompanyID, InvoiceID);
if (result == null)
@@ -132,7 +133,7 @@ namespace Back.Controllers
#region Inital Send
InvoiceHeaderDto header = new InvoiceHeaderDto();
#region header
if (header.Inty == 1 && header.Inp == 1)
if (result.inty == 1 && result.inp == 1)
header = new InvoiceHeaderDto
{
//نوع شخص خریدار
@@ -424,6 +425,7 @@ namespace Back.Controllers
InvoiceBody.Add(item);
}
var responseModel = await _actionTaxPayer.SendInvoice(user.RolUsers.First().CompanyID, header, InvoiceBody, new PaymentDto { });
if (responseModel == null)
{

View File

@@ -1,5 +1,6 @@
using Back.Common;
using Microsoft.IdentityModel.Tokens;
using Newtonsoft.Json;
using TaxCollectData.Library.Business;
using TaxCollectData.Library.Dto.Config;
using TaxCollectData.Library.Dto.Content;
@@ -35,6 +36,8 @@ namespace Back.Services
}
public async Task<TaxCollectData.Library.Dto.HttpResponse<AsyncResponseModel>> SendInvoice(int CompanyID,InvoiceHeaderDto header, List<InvoiceBodyDto> InvoiceBody, PaymentDto payment)
{
var stringtest = "{\"ReferenceNumber\":\"18084a18-1eb4-41cd-8bd3-2cad73c45398\",\"Uid\":\"0a4a4ab2-8047-4c31-b765-456ddf0e9c53\",\"Status\":\"SUCCESS\",\"Data\":{\"ValueKind\":1},\"PacketType\":\"receive_invoice_confirm\",\"FiscalId\":\"A2FFKZ\"}";
return JsonConvert.DeserializeObject<TaxCollectData.Library.Dto.HttpResponse<AsyncResponseModel>>(stringtest);
if (!await login(CompanyID))
return null;
return await TaxApiService.Instance.TaxApis.SendInvoicesAsync(new List<InvoiceDto>()

View File

@@ -8,6 +8,6 @@ namespace Shared.DTOs
public string Username { get; set; }
[MinLength(3, ErrorMessage = ("کلمه عبور باید حداقل 3 کاراکتر باشد"))]
public string Password { get; set; }
public bool Remember { get; set; }=false;
public bool Remember { get; set; }=true;
}
}