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: case 1:
return Ok(await _servInvoice.ChangeInvoiceType(Invoice, InvoiceType.Sale)); return Ok(await _servInvoice.ChangeInvoiceType(Invoice, InvoiceType.Sale));
case 3: case 3:
return Ok(await _servInvoice.ChangeInvoiceType(Invoice, InvoiceType.Cancellation)); return Ok(await _servInvoice.ChangeInvoiceType(Invoice, InvoiceType.Cancellation));
//case 0:
// return Ok(await _servInvoice.ChangeInvoiceType(Invoice, InvoiceType.CANCEL));
default: default:
return BadRequest(new List<string> { $"تغییر وضعیت از {Invoice.invoiceType.GetEnumDisplayName()} به {((InvoiceType)invoiceType).GetEnumDisplayName()} امکان پذیر نیست" }); return BadRequest(new List<string> { $"تغییر وضعیت از {Invoice.invoiceType.GetEnumDisplayName()} به {((InvoiceType)invoiceType).GetEnumDisplayName()} امکان پذیر نیست" });
} }
} }
if (Invoice.invoiceType == InvoiceType.Sale) if (Invoice.invoiceType == InvoiceType.Sale)
{ {
//if (sent)
//{
switch (invoiceType) switch (invoiceType)
{ {
//case 0:
// return Ok(await _servInvoice.ChangeInvoiceType(Invoice, InvoiceType.CANCEL));
case 3: case 3:
return Ok(await _servInvoice.ChangeInvoiceType(Invoice, InvoiceType.Cancellation)); return Ok(await _servInvoice.ChangeInvoiceType(Invoice, InvoiceType.Cancellation));
@@ -305,53 +297,9 @@ namespace Back.Controllers
default: default:
return BadRequest(new List<string> { $"تغییر وضعیت از {Invoice.invoiceType.GetEnumDisplayName()} به {((InvoiceType)invoiceType).GetEnumDisplayName()} امکان پذیر نیست این صورتحساب به سامانه مودیان ارسال شده" }); 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 (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) switch (invoiceType)
{ {
case 3: case 3:
@@ -391,53 +339,16 @@ namespace Back.Controllers
return BadRequest(new List<string> { $"تغییر وضعیت از {Invoice.invoiceType.GetEnumDisplayName()} به {((InvoiceType)invoiceType).GetEnumDisplayName()} امکان پذیر نیست این صورتحساب به سامانه مودیان ارسال شده" }); return BadRequest(new List<string> { $"تغییر وضعیت از {Invoice.invoiceType.GetEnumDisplayName()} به {((InvoiceType)invoiceType).GetEnumDisplayName()} امکان پذیر نیست این صورتحساب به سامانه مودیان ارسال شده" });
} }
//}
} }
if (Invoice.invoiceType == InvoiceType.BackFrmSale) if (Invoice.invoiceType == InvoiceType.BackFrmSale)
{ {
// if (!sent)
// {
switch (invoiceType) switch (invoiceType)
{ {
//case 0:
// return Ok(await _servInvoice.ChangeInvoiceType(Invoice, InvoiceType.CANCEL));
case 3: case 3:
return Ok(await _servInvoice.ChangeInvoiceType(Invoice, InvoiceType.Cancellation)); return Ok(await _servInvoice.ChangeInvoiceType(Invoice, InvoiceType.Cancellation));
default: default:
return BadRequest(new List<string> { $"تغییر وضعیت از {Invoice.invoiceType.GetEnumDisplayName()} به {((InvoiceType)invoiceType).GetEnumDisplayName()} امکان پذیر نیست" }); 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;
using System.Security.Cryptography; using System.Security.Cryptography;
using TaxCollectData.Library.Dto.Content; using TaxCollectData.Library.Dto.Content;
using TaxCollectData.Library.Dto.Transfer;
using static Shared.DTOs._TaxPayer; using static Shared.DTOs._TaxPayer;
using static System.Collections.Specialized.BitVector32; using static System.Collections.Specialized.BitVector32;
@@ -86,11 +87,11 @@ namespace Back.Controllers
public async Task<ActionResult<bool>> CheckAuth() public async Task<ActionResult<bool>> CheckAuth()
{ {
var claim = HttpContext.User.Claims.First(c => c.Type == "UserID"); //var claim = HttpContext.User.Claims.First(c => c.Type == "UserID");
var UserID = claim.Value; //var UserID = claim.Value;
var user = await _servUser.GetUserByUserID(Convert.ToInt32(UserID)); //var user = await _servUser.GetUserByUserID(Convert.ToInt32(UserID));
if (await _actionTaxPayer.login(user.RolUsers.First().CompanyID)) // return Ok(await _actionTaxPayer.login(user.RolUsers.First().CompanyID));
return Ok(); return Ok(true);
return BadRequest(); return BadRequest();
@@ -102,8 +103,8 @@ namespace Back.Controllers
var claim = HttpContext.User.Claims.First(c => c.Type == "UserID"); var claim = HttpContext.User.Claims.First(c => c.Type == "UserID");
var UserID = claim.Value; var UserID = claim.Value;
var user = await _servUser.GetUserByUserID(Convert.ToInt32(UserID)); var user = await _servUser.GetUserByUserID(Convert.ToInt32(UserID));
if (!await _actionTaxPayer.login(user.RolUsers.First().CompanyID)) //if (!await _actionTaxPayer.login(user.RolUsers.First().CompanyID))
return BadRequest(new List<string> { "خطا در احراز هویت سازمان مالیاتی" }); // return BadRequest(new List<string> { "خطا در احراز هویت سازمان مالیاتی" });
var result = await _servTaxPayer.GetInvoice(user.RolUsers.First().CompanyID, InvoiceID); var result = await _servTaxPayer.GetInvoice(user.RolUsers.First().CompanyID, InvoiceID);
if (result == null) if (result == null)
@@ -132,7 +133,7 @@ namespace Back.Controllers
#region Inital Send #region Inital Send
InvoiceHeaderDto header = new InvoiceHeaderDto(); InvoiceHeaderDto header = new InvoiceHeaderDto();
#region header #region header
if (header.Inty == 1 && header.Inp == 1) if (result.inty == 1 && result.inp == 1)
header = new InvoiceHeaderDto header = new InvoiceHeaderDto
{ {
//نوع شخص خریدار //نوع شخص خریدار
@@ -424,6 +425,7 @@ namespace Back.Controllers
InvoiceBody.Add(item); InvoiceBody.Add(item);
} }
var responseModel = await _actionTaxPayer.SendInvoice(user.RolUsers.First().CompanyID, header, InvoiceBody, new PaymentDto { }); var responseModel = await _actionTaxPayer.SendInvoice(user.RolUsers.First().CompanyID, header, InvoiceBody, new PaymentDto { });
if (responseModel == null) if (responseModel == null)
{ {

View File

@@ -1,5 +1,6 @@
using Back.Common; using Back.Common;
using Microsoft.IdentityModel.Tokens; using Microsoft.IdentityModel.Tokens;
using Newtonsoft.Json;
using TaxCollectData.Library.Business; using TaxCollectData.Library.Business;
using TaxCollectData.Library.Dto.Config; using TaxCollectData.Library.Dto.Config;
using TaxCollectData.Library.Dto.Content; 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) 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)) if (!await login(CompanyID))
return null; return null;
return await TaxApiService.Instance.TaxApis.SendInvoicesAsync(new List<InvoiceDto>() return await TaxApiService.Instance.TaxApis.SendInvoicesAsync(new List<InvoiceDto>()

View File

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