docker
This commit is contained in:
30
.dockerignore
Normal file
30
.dockerignore
Normal file
@@ -0,0 +1,30 @@
|
||||
**/.classpath
|
||||
**/.dockerignore
|
||||
**/.env
|
||||
**/.git
|
||||
**/.gitignore
|
||||
**/.project
|
||||
**/.settings
|
||||
**/.toolstarget
|
||||
**/.vs
|
||||
**/.vscode
|
||||
**/*.*proj.user
|
||||
**/*.dbmdl
|
||||
**/*.jfm
|
||||
**/azds.yaml
|
||||
**/bin
|
||||
**/charts
|
||||
**/docker-compose*
|
||||
**/Dockerfile*
|
||||
**/node_modules
|
||||
**/npm-debug.log
|
||||
**/obj
|
||||
**/secrets.dev.yaml
|
||||
**/values.dev.yaml
|
||||
LICENSE
|
||||
README.md
|
||||
!**/.gitignore
|
||||
!.git/HEAD
|
||||
!.git/config
|
||||
!.git/packed-refs
|
||||
!.git/refs/heads/**
|
5
Back/.config/dotnet-tools.json
Normal file
5
Back/.config/dotnet-tools.json
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"version": 1,
|
||||
"isRoot": true,
|
||||
"tools": {}
|
||||
}
|
@@ -4,12 +4,15 @@
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<UserSecretsId>3a1884b0-3dfb-48c8-8b55-fac6d02b8d35</UserSecretsId>
|
||||
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Blazor.PersianDatePicker" Version="2.1.0" />
|
||||
<PackageReference Include="Melipayamak.RestClient" Version="1.0.0" />
|
||||
<PackageReference Include="Microsoft.Data.SqlClient" Version="5.2.0" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.21.0" />
|
||||
<PackageReference Include="SixLabors.ImageSharp" Version="3.1.5" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" />
|
||||
<PackageReference Include="FluentValidation" Version="11.9.0" />
|
||||
@@ -25,7 +28,7 @@
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="System.Drawing.Common" Version="9.0.0" />
|
||||
<PackageReference Include="TaxCollectData.Library" Version="0.0.23" />
|
||||
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
@@ -36,10 +39,4 @@
|
||||
<ProjectReference Include="..\Shared\Shared.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Reference Include="Service">
|
||||
<HintPath>C:\Dlls\Service.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
@@ -4,7 +4,6 @@ using Back.Services;
|
||||
using Back.Validations;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Service;
|
||||
using Shared.DTOs;
|
||||
using System.Net;
|
||||
using System.Reflection.Emit;
|
||||
|
@@ -6,18 +6,10 @@ using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Http.HttpResults;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Newtonsoft.Json;
|
||||
using Org.BouncyCastle.Asn1.Cmp;
|
||||
using Org.BouncyCastle.Ocsp;
|
||||
using Org.BouncyCastle.Utilities;
|
||||
|
||||
using Shared.DTOs;
|
||||
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;
|
||||
|
||||
namespace Back.Controllers
|
||||
{
|
||||
@@ -152,326 +144,326 @@ namespace Back.Controllers
|
||||
[HttpGet("SendInvoice/{InvoiceID}")]
|
||||
public async Task<ActionResult<bool>> SendInvoice(int InvoiceID)
|
||||
{
|
||||
//return BadRequest(new List<string> { "در حال حاضر سامانه مودیان در دسترس نمی باشد" });
|
||||
return BadRequest(new List<string> { "در حال حاضر سامانه مودیان در دسترس نمی باشد" });
|
||||
|
||||
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> { "خطا در احراز هویت سازمان مالیاتی" });
|
||||
//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> { "خطا در احراز هویت سازمان مالیاتی" });
|
||||
|
||||
var result = await _servTaxPayer.GetInvoice(user.RolUsers.First().CompanyID, InvoiceID);
|
||||
if (result == null)
|
||||
return BadRequest(new List<string> { "صورتحساب یافت نشد" });
|
||||
//var result = await _servTaxPayer.GetInvoice(user.RolUsers.First().CompanyID, InvoiceID);
|
||||
//if (result == null)
|
||||
// return BadRequest(new List<string> { "صورتحساب یافت نشد" });
|
||||
|
||||
else
|
||||
{
|
||||
if (!result.PatternID.HasValue)
|
||||
return BadRequest(new List<string> { "ابتدا برای این صورتحساب الگو در نظر بگیرید" });
|
||||
//else
|
||||
//{
|
||||
// if (!result.PatternID.HasValue)
|
||||
// return BadRequest(new List<string> { "ابتدا برای این صورتحساب الگو در نظر بگیرید" });
|
||||
|
||||
if (result.invoiceType == InvoiceType.Bidding)
|
||||
return BadRequest(new List<string> { "صورتحساب در وضعیت پیش نویس نمیتواند ارسال شود" });
|
||||
// if (result.invoiceType == InvoiceType.Bidding)
|
||||
// return BadRequest(new List<string> { "صورتحساب در وضعیت پیش نویس نمیتواند ارسال شود" });
|
||||
|
||||
if (await _servTaxPayer.ExistSuccessfulorSendorpendingInvoice(result))
|
||||
return BadRequest(new List<string> { "این صورتحساب قبلا به سازمان ارسال شده" });
|
||||
// if (await _servTaxPayer.ExistSuccessfulorSendorpendingInvoice(result))
|
||||
// return BadRequest(new List<string> { "این صورتحساب قبلا به سازمان ارسال شده" });
|
||||
|
||||
if ((result.invoiceType == InvoiceType.BackFrmSale || result.invoiceType == InvoiceType.Repair)
|
||||
&& !result.BillReference.HasValue)
|
||||
return BadRequest(new List<string> { "در وضعیت برگشت از فروش و اصلاحی باید صورتحساب مرجع وجود داشته باشد" });
|
||||
// if ((result.invoiceType == InvoiceType.BackFrmSale || result.invoiceType == InvoiceType.Repair)
|
||||
// && !result.BillReference.HasValue)
|
||||
// return BadRequest(new List<string> { "در وضعیت برگشت از فروش و اصلاحی باید صورتحساب مرجع وجود داشته باشد" });
|
||||
|
||||
|
||||
if ((result.invoiceType == InvoiceType.BackFrmSale || result.invoiceType == InvoiceType.Repair)
|
||||
&& !await _servTaxPayer.ExistSuccessfulorSendorpendingInvoice(result.invoice))
|
||||
return BadRequest(new List<string> { "در وضعیت برگشت از فروش و اصلاحی باید صورتحساب مرجع به سامانه مودیان ارسال شده باشد" });
|
||||
// if ((result.invoiceType == InvoiceType.BackFrmSale || result.invoiceType == InvoiceType.Repair)
|
||||
// && !await _servTaxPayer.ExistSuccessfulorSendorpendingInvoice(result.invoice))
|
||||
// return BadRequest(new List<string> { "در وضعیت برگشت از فروش و اصلاحی باید صورتحساب مرجع به سامانه مودیان ارسال شده باشد" });
|
||||
|
||||
if (result.invoiceType == InvoiceType.Cancellation && string.IsNullOrEmpty(result.taxid))
|
||||
{
|
||||
return BadRequest(new List<string> { "صورتحساب در وضعیت ابطالی باید صورتحساب مرجع آن به سامانه مودیان ارسال شده باشد" });
|
||||
// if (result.invoiceType == InvoiceType.Cancellation && string.IsNullOrEmpty(result.taxid))
|
||||
// {
|
||||
// return BadRequest(new List<string> { "صورتحساب در وضعیت ابطالی باید صورتحساب مرجع آن به سامانه مودیان ارسال شده باشد" });
|
||||
|
||||
}
|
||||
#region Inital Send
|
||||
InvoiceHeaderDto header = new InvoiceHeaderDto();
|
||||
PreparationHeaderTaxInvoice preparation = new PreparationHeaderTaxInvoice(result, _actionTaxPayer);
|
||||
// }
|
||||
// #region Inital Send
|
||||
// InvoiceHeaderDto header = new InvoiceHeaderDto();
|
||||
// PreparationHeaderTaxInvoice preparation = new PreparationHeaderTaxInvoice(result, _actionTaxPayer);
|
||||
|
||||
|
||||
int level = result.pattern.ID;
|
||||
// int level = result.pattern.ID;
|
||||
|
||||
//header
|
||||
#region header
|
||||
header = new InvoiceHeaderDto
|
||||
{
|
||||
//شماره منحصر به فرد مالیاتی
|
||||
Taxid = preparation.Taxid,
|
||||
//زمان صدور
|
||||
Indatim = preparation.Indatim,
|
||||
//زمان ایجاد
|
||||
Indati2m = preparation.Indati2m,
|
||||
// صورتحساب نوع *
|
||||
Inty = preparation.Inty,
|
||||
//سریال صورت حساب
|
||||
Inno = preparation.Inno,
|
||||
//شماره منحصر به فرد مالیاتی صورتحساب مرجع
|
||||
Irtaxid = preparation.Irtaxid,
|
||||
//الگوی صورتحساب *
|
||||
Inp = preparation.Inp,
|
||||
//موضوع صورتحساب *
|
||||
Ins = preparation.Ins,
|
||||
//شماره اقتصادی فروشنده به جاش شناسه ملی داده شد
|
||||
Tins = preparation.Tins,
|
||||
//نوع شخص خریدار
|
||||
Tob = preparation.Tob,
|
||||
//شماره/شناسه ملی/شناسه مشارکت مدنی / کد فراگیر
|
||||
Bid = preparation.Bid,
|
||||
//شماره اقتصادی خریدار
|
||||
Tinb = preparation.Tinb,
|
||||
//کد شعبه فروشنده
|
||||
Sbc = preparation.Sbc,
|
||||
//کد پستی خریدار
|
||||
Bpc = preparation.Bpc,
|
||||
//کد شعبه خریدار
|
||||
Bbc = preparation.Bbc,
|
||||
//نوع پرواز
|
||||
Ft = preparation.Ft,
|
||||
//شماره گذرنامه خریدار
|
||||
Bpn = preparation.Bpn,
|
||||
//شماره پروانه گمرکی
|
||||
Scln = preparation.Scln,
|
||||
//کد گمرک محل اظهار فروشنده
|
||||
Scc = preparation.Scc,
|
||||
//شماره کدتاژ اظهارنامه گمرکی
|
||||
Cdcn = preparation.Cdcn,
|
||||
//تاریخ کوتاژ اظهارنامه گمرکی
|
||||
Cdcd = preparation.Cdcd,
|
||||
//شناسه یکتای ثبت قزارداد فروشنده
|
||||
Crn = preparation.Crn,
|
||||
//شماره اشتراک/شناسه قبض بهره بردار
|
||||
Billid = preparation.Billid,
|
||||
//مجموع مبلغ قبل از کسر تخفیف
|
||||
Tprdis = preparation.Tprdis,
|
||||
//مجموع تخفیفات
|
||||
Tdis = preparation.Tdis,
|
||||
// مجموع مبلغ پس از کسر تخفیف
|
||||
Tadis = preparation.Tadis,
|
||||
//مجموع مالیات بر ارزش افزوده
|
||||
Tvam = preparation.Tvam,
|
||||
// مجموع سایر مالیات، عوارض و وجوه قانونی
|
||||
Todam = preparation.Todam,
|
||||
//صورتحساب مجموع
|
||||
Tbill = preparation.Tbill,
|
||||
//مجموع وزن خالض
|
||||
Tonw = preparation.Tonw,
|
||||
//مجموع ارزش ریالی
|
||||
Torv = preparation.Torv,
|
||||
//مجموع ارزش ارزی
|
||||
Tocv = preparation.Tocv,
|
||||
// تسویه روش
|
||||
Setm = preparation.Setm,
|
||||
//نقدی پرداختی مبلغ
|
||||
Cap = preparation.Cap,
|
||||
//پرداختی نسیه
|
||||
Insp = preparation.Insp,
|
||||
//مجموع سهم مالیات بر ارزش افزوده از پرداخت
|
||||
Tvop = preparation.Tvop,
|
||||
//مالیات موضوع 17
|
||||
Tax17 = preparation.Tax17,
|
||||
//شماره اقتصادی آژانس
|
||||
Tinc = preparation.Tinc,
|
||||
//تاریخ اعلامیه فروش
|
||||
Asd=null,
|
||||
//شماره اعلامیه فروش
|
||||
Asn = null,
|
||||
//شماره ناوگان
|
||||
Cno=null,
|
||||
//شهر مقصد
|
||||
Dci = null,
|
||||
//کشور مقصد
|
||||
Dco = null,
|
||||
//کد ملی/ کد فراگیر اتباع غیر ایرانی راننده) در حمل و نقل جاده ای(
|
||||
Did = null,
|
||||
//شماره بارنامه
|
||||
Lno = null,
|
||||
//شماره بارنامه مرجع
|
||||
Lrno = null,
|
||||
//نوع بارنامه/ نوع حمل
|
||||
Lt = null,
|
||||
//شهر مبدا
|
||||
Oci = null,
|
||||
//کشور مبدا
|
||||
Ocu = null,
|
||||
//شناسه ملی/ شماره ملی/ شناسه مشارکت مدنی/ کد فراگیر اتباع غیر ایرانی گیرنده
|
||||
Rid = null,
|
||||
//کالاهای حمل شده
|
||||
Sg = new List<ShippingGoodDto>(),
|
||||
//شناسه ملی/ شماره ملی/ شناسه مشارکت مدنی / کد فراگیر اتباع غیر ایرانی فرستنده
|
||||
Tid =null
|
||||
// //header
|
||||
// #region header
|
||||
// header = new InvoiceHeaderDto
|
||||
// {
|
||||
// //شماره منحصر به فرد مالیاتی
|
||||
// Taxid = preparation.Taxid,
|
||||
// //زمان صدور
|
||||
// Indatim = preparation.Indatim,
|
||||
// //زمان ایجاد
|
||||
// Indati2m = preparation.Indati2m,
|
||||
// // صورتحساب نوع *
|
||||
// Inty = preparation.Inty,
|
||||
// //سریال صورت حساب
|
||||
// Inno = preparation.Inno,
|
||||
// //شماره منحصر به فرد مالیاتی صورتحساب مرجع
|
||||
// Irtaxid = preparation.Irtaxid,
|
||||
// //الگوی صورتحساب *
|
||||
// Inp = preparation.Inp,
|
||||
// //موضوع صورتحساب *
|
||||
// Ins = preparation.Ins,
|
||||
// //شماره اقتصادی فروشنده به جاش شناسه ملی داده شد
|
||||
// Tins = preparation.Tins,
|
||||
// //نوع شخص خریدار
|
||||
// Tob = preparation.Tob,
|
||||
// //شماره/شناسه ملی/شناسه مشارکت مدنی / کد فراگیر
|
||||
// Bid = preparation.Bid,
|
||||
// //شماره اقتصادی خریدار
|
||||
// Tinb = preparation.Tinb,
|
||||
// //کد شعبه فروشنده
|
||||
// Sbc = preparation.Sbc,
|
||||
// //کد پستی خریدار
|
||||
// Bpc = preparation.Bpc,
|
||||
// //کد شعبه خریدار
|
||||
// Bbc = preparation.Bbc,
|
||||
// //نوع پرواز
|
||||
// Ft = preparation.Ft,
|
||||
// //شماره گذرنامه خریدار
|
||||
// Bpn = preparation.Bpn,
|
||||
// //شماره پروانه گمرکی
|
||||
// Scln = preparation.Scln,
|
||||
// //کد گمرک محل اظهار فروشنده
|
||||
// Scc = preparation.Scc,
|
||||
// //شماره کدتاژ اظهارنامه گمرکی
|
||||
// Cdcn = preparation.Cdcn,
|
||||
// //تاریخ کوتاژ اظهارنامه گمرکی
|
||||
// Cdcd = preparation.Cdcd,
|
||||
// //شناسه یکتای ثبت قزارداد فروشنده
|
||||
// Crn = preparation.Crn,
|
||||
// //شماره اشتراک/شناسه قبض بهره بردار
|
||||
// Billid = preparation.Billid,
|
||||
// //مجموع مبلغ قبل از کسر تخفیف
|
||||
// Tprdis = preparation.Tprdis,
|
||||
// //مجموع تخفیفات
|
||||
// Tdis = preparation.Tdis,
|
||||
// // مجموع مبلغ پس از کسر تخفیف
|
||||
// Tadis = preparation.Tadis,
|
||||
// //مجموع مالیات بر ارزش افزوده
|
||||
// Tvam = preparation.Tvam,
|
||||
// // مجموع سایر مالیات، عوارض و وجوه قانونی
|
||||
// Todam = preparation.Todam,
|
||||
// //صورتحساب مجموع
|
||||
// Tbill = preparation.Tbill,
|
||||
// //مجموع وزن خالض
|
||||
// Tonw = preparation.Tonw,
|
||||
// //مجموع ارزش ریالی
|
||||
// Torv = preparation.Torv,
|
||||
// //مجموع ارزش ارزی
|
||||
// Tocv = preparation.Tocv,
|
||||
// // تسویه روش
|
||||
// Setm = preparation.Setm,
|
||||
// //نقدی پرداختی مبلغ
|
||||
// Cap = preparation.Cap,
|
||||
// //پرداختی نسیه
|
||||
// Insp = preparation.Insp,
|
||||
// //مجموع سهم مالیات بر ارزش افزوده از پرداخت
|
||||
// Tvop = preparation.Tvop,
|
||||
// //مالیات موضوع 17
|
||||
// Tax17 = preparation.Tax17,
|
||||
// //شماره اقتصادی آژانس
|
||||
// Tinc = preparation.Tinc,
|
||||
// //تاریخ اعلامیه فروش
|
||||
// Asd=null,
|
||||
// //شماره اعلامیه فروش
|
||||
// Asn = null,
|
||||
// //شماره ناوگان
|
||||
// Cno=null,
|
||||
// //شهر مقصد
|
||||
// Dci = null,
|
||||
// //کشور مقصد
|
||||
// Dco = null,
|
||||
// //کد ملی/ کد فراگیر اتباع غیر ایرانی راننده) در حمل و نقل جاده ای(
|
||||
// Did = null,
|
||||
// //شماره بارنامه
|
||||
// Lno = null,
|
||||
// //شماره بارنامه مرجع
|
||||
// Lrno = null,
|
||||
// //نوع بارنامه/ نوع حمل
|
||||
// Lt = null,
|
||||
// //شهر مبدا
|
||||
// Oci = null,
|
||||
// //کشور مبدا
|
||||
// Ocu = null,
|
||||
// //شناسه ملی/ شماره ملی/ شناسه مشارکت مدنی/ کد فراگیر اتباع غیر ایرانی گیرنده
|
||||
// Rid = null,
|
||||
// //کالاهای حمل شده
|
||||
// Sg = new List<ShippingGoodDto>(),
|
||||
// //شناسه ملی/ شماره ملی/ شناسه مشارکت مدنی / کد فراگیر اتباع غیر ایرانی فرستنده
|
||||
// Tid =null
|
||||
|
||||
};
|
||||
#endregion header
|
||||
// };
|
||||
// #endregion header
|
||||
|
||||
|
||||
|
||||
|
||||
//body
|
||||
List<InvoiceBodyDto> InvoiceBody = new List<InvoiceBodyDto>();
|
||||
foreach (var bitem in result.invoiceDetails)
|
||||
{
|
||||
InvoiceBodyDto item = new InvoiceBodyDto();
|
||||
PreparationBodyTaxInvoice preparationBody = new PreparationBodyTaxInvoice(bitem, level);
|
||||
#region body
|
||||
// //body
|
||||
// List<InvoiceBodyDto> InvoiceBody = new List<InvoiceBodyDto>();
|
||||
// foreach (var bitem in result.invoiceDetails)
|
||||
// {
|
||||
// InvoiceBodyDto item = new InvoiceBodyDto();
|
||||
// PreparationBodyTaxInvoice preparationBody = new PreparationBodyTaxInvoice(bitem, level);
|
||||
// #region body
|
||||
|
||||
item = new InvoiceBodyDto
|
||||
{
|
||||
//شناسه کالا / خدمت
|
||||
Sstid = preparationBody.Sstid,
|
||||
//شرح کاال/خدمت
|
||||
Sstt = preparationBody.Sstt,
|
||||
// تعداد
|
||||
Am = preparationBody.Am,
|
||||
//واحد اندازه گیری
|
||||
Mu = preparationBody.Mu,
|
||||
//وزن خالص
|
||||
Nw= preparationBody.Nw,
|
||||
// مبلغ واحد
|
||||
Fee = preparationBody.Fee,
|
||||
//میزان ارز
|
||||
Cfee = preparationBody.Cfee ,
|
||||
//نوع ارز
|
||||
Cut = preparationBody.Cut,
|
||||
//نرخ برابری ارز با ریال
|
||||
Exr = preparationBody.Exr,
|
||||
// ارزش ریالی کاا
|
||||
Ssrv= preparationBody.Ssrv,
|
||||
// ارزش ارزی کاا
|
||||
Sscv= preparationBody.Sscv,
|
||||
//مبلغ قبل از تخفیف
|
||||
Prdis = preparationBody.Prdis,
|
||||
//مبلغ تخفیف
|
||||
Dis = preparationBody.Dis,
|
||||
//مبلغ بعد از تخفیف
|
||||
Adis = preparationBody.Adis,
|
||||
//نرخ مالیات بر ارزش افزوده
|
||||
Vra = preparationBody.Vra,
|
||||
//مبلغ مالیات بر ارزش افزوده
|
||||
Vam = preparationBody.Vam,
|
||||
//موضوع سایر مالیات و عوارض
|
||||
Odt = preparationBody.Odt,
|
||||
//نرخ سایر مالیات و عوارض
|
||||
Odr = preparationBody.Odr,
|
||||
//مبلغ سایر مالیات و عوارض
|
||||
Odam = preparationBody.Odam,
|
||||
//موضوع سایر وجوه قانونی
|
||||
Olt = preparationBody.Olt,
|
||||
//نرخ سایر وجوه قانونی
|
||||
Olr = preparationBody.Olr,
|
||||
//مبلغ سایر وجوه قانونی
|
||||
Olam = preparationBody.Olam,
|
||||
//اجرت ساخت
|
||||
Consfee = preparationBody.Consfee,
|
||||
// سود فروشنده
|
||||
Spro= preparationBody.Spro,
|
||||
//حقالعمل
|
||||
Bros= preparationBody.Bros,
|
||||
//جمع کل اجرت، حقالعمل و سود
|
||||
Tcpbs= preparationBody.Tcpbs,
|
||||
//سهم نقدی از پرداخت
|
||||
Cop = preparationBody.Cop,
|
||||
//سهم مالیات بر لرزش افزوده از پرداخت
|
||||
Vop = preparationBody.Vop,
|
||||
//شناسه یکتای ثبت قرارداد حق العمل کاری
|
||||
Bsrn = preparationBody.Bsrn,
|
||||
// مبلغ کل کالا / خدمت
|
||||
Tsstam = preparationBody.Tsstam,
|
||||
//عیار
|
||||
Cui = preparationBody.Cui,
|
||||
// نرخ خرید ارز
|
||||
Cpr = preparationBody.Cpr,
|
||||
//ماخذ مالیات بر ارزش افزوده در الگوی فروش ارز
|
||||
Sovat = preparationBody.Sovat
|
||||
};
|
||||
#endregion
|
||||
InvoiceBody.Add(item);
|
||||
}
|
||||
// item = new InvoiceBodyDto
|
||||
// {
|
||||
// //شناسه کالا / خدمت
|
||||
// Sstid = preparationBody.Sstid,
|
||||
// //شرح کاال/خدمت
|
||||
// Sstt = preparationBody.Sstt,
|
||||
// // تعداد
|
||||
// Am = preparationBody.Am,
|
||||
// //واحد اندازه گیری
|
||||
// Mu = preparationBody.Mu,
|
||||
// //وزن خالص
|
||||
// Nw= preparationBody.Nw,
|
||||
// // مبلغ واحد
|
||||
// Fee = preparationBody.Fee,
|
||||
// //میزان ارز
|
||||
// Cfee = preparationBody.Cfee ,
|
||||
// //نوع ارز
|
||||
// Cut = preparationBody.Cut,
|
||||
// //نرخ برابری ارز با ریال
|
||||
// Exr = preparationBody.Exr,
|
||||
// // ارزش ریالی کاا
|
||||
// Ssrv= preparationBody.Ssrv,
|
||||
// // ارزش ارزی کاا
|
||||
// Sscv= preparationBody.Sscv,
|
||||
// //مبلغ قبل از تخفیف
|
||||
// Prdis = preparationBody.Prdis,
|
||||
// //مبلغ تخفیف
|
||||
// Dis = preparationBody.Dis,
|
||||
// //مبلغ بعد از تخفیف
|
||||
// Adis = preparationBody.Adis,
|
||||
// //نرخ مالیات بر ارزش افزوده
|
||||
// Vra = preparationBody.Vra,
|
||||
// //مبلغ مالیات بر ارزش افزوده
|
||||
// Vam = preparationBody.Vam,
|
||||
// //موضوع سایر مالیات و عوارض
|
||||
// Odt = preparationBody.Odt,
|
||||
// //نرخ سایر مالیات و عوارض
|
||||
// Odr = preparationBody.Odr,
|
||||
// //مبلغ سایر مالیات و عوارض
|
||||
// Odam = preparationBody.Odam,
|
||||
// //موضوع سایر وجوه قانونی
|
||||
// Olt = preparationBody.Olt,
|
||||
// //نرخ سایر وجوه قانونی
|
||||
// Olr = preparationBody.Olr,
|
||||
// //مبلغ سایر وجوه قانونی
|
||||
// Olam = preparationBody.Olam,
|
||||
// //اجرت ساخت
|
||||
// Consfee = preparationBody.Consfee,
|
||||
// // سود فروشنده
|
||||
// Spro= preparationBody.Spro,
|
||||
// //حقالعمل
|
||||
// Bros= preparationBody.Bros,
|
||||
// //جمع کل اجرت، حقالعمل و سود
|
||||
// Tcpbs= preparationBody.Tcpbs,
|
||||
// //سهم نقدی از پرداخت
|
||||
// Cop = preparationBody.Cop,
|
||||
// //سهم مالیات بر لرزش افزوده از پرداخت
|
||||
// Vop = preparationBody.Vop,
|
||||
// //شناسه یکتای ثبت قرارداد حق العمل کاری
|
||||
// Bsrn = preparationBody.Bsrn,
|
||||
// // مبلغ کل کالا / خدمت
|
||||
// Tsstam = preparationBody.Tsstam,
|
||||
// //عیار
|
||||
// Cui = preparationBody.Cui,
|
||||
// // نرخ خرید ارز
|
||||
// Cpr = preparationBody.Cpr,
|
||||
// //ماخذ مالیات بر ارزش افزوده در الگوی فروش ارز
|
||||
// Sovat = preparationBody.Sovat
|
||||
// };
|
||||
// #endregion
|
||||
// InvoiceBody.Add(item);
|
||||
// }
|
||||
|
||||
|
||||
//Pay
|
||||
List<PaymentDto> InvoicePay = new List<PaymentDto>();
|
||||
if (result.setm==1 || result.setm == 3)
|
||||
{
|
||||
if (level != 10)
|
||||
foreach (var pitem in result.payments)
|
||||
{
|
||||
// //Pay
|
||||
// List<PaymentDto> InvoicePay = new List<PaymentDto>();
|
||||
// if (result.setm==1 || result.setm == 3)
|
||||
// {
|
||||
// if (level != 10)
|
||||
// foreach (var pitem in result.payments)
|
||||
// {
|
||||
|
||||
PaymentDto payment = new PaymentDto();
|
||||
payment = new PaymentDto
|
||||
{
|
||||
Iinn = pitem.iinn,
|
||||
Acn = pitem.acn,
|
||||
Trmn = pitem.trmn,
|
||||
Pmt = pitem.pmt,
|
||||
Trn = pitem.trn,
|
||||
Pcn = pitem.pcn,
|
||||
Pid = pitem.pid,
|
||||
Pdt = pitem.pdt,
|
||||
Pv = pitem.pv,
|
||||
// PaymentDto payment = new PaymentDto();
|
||||
// payment = new PaymentDto
|
||||
// {
|
||||
// Iinn = pitem.iinn,
|
||||
// Acn = pitem.acn,
|
||||
// Trmn = pitem.trmn,
|
||||
// Pmt = pitem.pmt,
|
||||
// Trn = pitem.trn,
|
||||
// Pcn = pitem.pcn,
|
||||
// Pid = pitem.pid,
|
||||
// Pdt = pitem.pdt,
|
||||
// Pv = pitem.pv,
|
||||
|
||||
};
|
||||
// };
|
||||
|
||||
InvoicePay.Add(payment);
|
||||
}
|
||||
}
|
||||
// InvoicePay.Add(payment);
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
var responseModel = await _actionTaxPayer.SendInvoice(user.RolUsers.First().CompanyID, header, InvoiceBody, InvoicePay);
|
||||
if (responseModel == null)
|
||||
{
|
||||
return BadRequest(new List<string> { "خطا در ورود به سامانه مودیان" });
|
||||
}
|
||||
else if (responseModel.Status == 200 && (responseModel.Body.Errors == null || responseModel.Body.Errors.Count == 0))
|
||||
{
|
||||
foreach (var item in responseModel.Body.Result)
|
||||
{
|
||||
// var responseModel = await _actionTaxPayer.SendInvoice(user.RolUsers.First().CompanyID, header, InvoiceBody, InvoicePay);
|
||||
// if (responseModel == null)
|
||||
// {
|
||||
// return BadRequest(new List<string> { "خطا در ورود به سامانه مودیان" });
|
||||
// }
|
||||
// else if (responseModel.Status == 200 && (responseModel.Body.Errors == null || responseModel.Body.Errors.Count == 0))
|
||||
// {
|
||||
// foreach (var item in responseModel.Body.Result)
|
||||
// {
|
||||
|
||||
|
||||
var ressenttax = new SentTax
|
||||
{
|
||||
InvoiceID = result.ID,
|
||||
Date = DateTime.Now.ConvertMiladiToShamsi(),
|
||||
Time = $"{DateTime.Now.Hour}:{DateTime.Now.Minute}:{DateTime.Now.Second}",
|
||||
InvoiceType = result.invoiceType,
|
||||
ReferenceNumber = item.ReferenceNumber,
|
||||
uId = item.Uid,
|
||||
SentStatus = SentStatus.Send,
|
||||
InvoiceModel = JsonConvert.SerializeObject(result, Formatting.Indented, new JsonSerializerSettings
|
||||
{
|
||||
PreserveReferencesHandling = PreserveReferencesHandling.Objects
|
||||
}),
|
||||
ResponseModel = JsonConvert.SerializeObject(responseModel)
|
||||
// var ressenttax = new SentTax
|
||||
// {
|
||||
// InvoiceID = result.ID,
|
||||
// Date = DateTime.Now.ConvertMiladiToShamsi(),
|
||||
// Time = $"{DateTime.Now.Hour}:{DateTime.Now.Minute}:{DateTime.Now.Second}",
|
||||
// InvoiceType = result.invoiceType,
|
||||
// ReferenceNumber = item.ReferenceNumber,
|
||||
// uId = item.Uid,
|
||||
// SentStatus = SentStatus.Send,
|
||||
// InvoiceModel = JsonConvert.SerializeObject(result, Formatting.Indented, new JsonSerializerSettings
|
||||
// {
|
||||
// PreserveReferencesHandling = PreserveReferencesHandling.Objects
|
||||
// }),
|
||||
// ResponseModel = JsonConvert.SerializeObject(responseModel)
|
||||
|
||||
};
|
||||
await _servTaxPayer.AddSentTax(ressenttax);
|
||||
}
|
||||
result.taxid = header.Taxid;
|
||||
result.irtaxid = header.Irtaxid;
|
||||
return Ok(await _servTaxPayer.UpdateInvoice(result));
|
||||
}
|
||||
else
|
||||
{
|
||||
string errors = "";
|
||||
foreach (var item in responseModel.Body.Errors)
|
||||
errors += '\n' + $"{item.ErrorCode}:{item.Detail}";
|
||||
// };
|
||||
// await _servTaxPayer.AddSentTax(ressenttax);
|
||||
// }
|
||||
// result.taxid = header.Taxid;
|
||||
// result.irtaxid = header.Irtaxid;
|
||||
// return Ok(await _servTaxPayer.UpdateInvoice(result));
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// string errors = "";
|
||||
// foreach (var item in responseModel.Body.Errors)
|
||||
// errors += '\n' + $"{item.ErrorCode}:{item.Detail}";
|
||||
|
||||
return BadRequest(new List<string> { errors });
|
||||
}
|
||||
// return BadRequest(new List<string> { errors });
|
||||
// }
|
||||
|
||||
|
||||
#endregion
|
||||
// #endregion
|
||||
|
||||
|
||||
}
|
||||
//}
|
||||
}
|
||||
[HttpPost("GetAllSentTax")]
|
||||
public async Task<ActionResult<PagingDto<SentTaxDto>>> GetSentTax([FromBody] ItemSerchGetSentTax item)
|
||||
@@ -484,88 +476,90 @@ namespace Back.Controllers
|
||||
[HttpGet("GetResult/{ID}")]
|
||||
public async Task<ActionResult<DataInSendTaxDto>> GetResultByUid(int ID)
|
||||
{
|
||||
try
|
||||
{
|
||||
var claim = HttpContext.User.Claims.First(c => c.Type == "UserID");
|
||||
var UserID = claim.Value;
|
||||
var user = await _servUser.GetUserByUserID(Convert.ToInt32(UserID));
|
||||
var item = await _servTaxPayer.GetSentTax(user.RolUsers.First().CompanyID, ID);
|
||||
if (item == null)
|
||||
return BadRequest(new List<string> { "یافت نشد" });
|
||||
return BadRequest(new List<string> { "در حال حاضر سامانه مودیان در دسترس نمی باشد" });
|
||||
|
||||
if (string.IsNullOrEmpty(item.uId))
|
||||
return BadRequest(new List<string> { "کد پیگیری یافت نشد" });
|
||||
//try
|
||||
//{
|
||||
// var claim = HttpContext.User.Claims.First(c => c.Type == "UserID");
|
||||
// var UserID = claim.Value;
|
||||
// var user = await _servUser.GetUserByUserID(Convert.ToInt32(UserID));
|
||||
// var item = await _servTaxPayer.GetSentTax(user.RolUsers.First().CompanyID, ID);
|
||||
// if (item == null)
|
||||
// return BadRequest(new List<string> { "یافت نشد" });
|
||||
|
||||
if (!await _actionTaxPayer.login(user.RolUsers.First().CompanyID))
|
||||
return BadRequest(new List<string> { "خطا در احراز هویت سازمان مالیاتی" });
|
||||
// if (string.IsNullOrEmpty(item.uId))
|
||||
// return BadRequest(new List<string> { "کد پیگیری یافت نشد" });
|
||||
|
||||
DataInSendTaxDto desData = new DataInSendTaxDto();
|
||||
// if (!await _actionTaxPayer.login(user.RolUsers.First().CompanyID))
|
||||
// return BadRequest(new List<string> { "خطا در احراز هویت سازمان مالیاتی" });
|
||||
|
||||
// DataInSendTaxDto desData = new DataInSendTaxDto();
|
||||
|
||||
|
||||
if (item.SentStatus == SentStatus.Unsuccessful && !string.IsNullOrEmpty(item.ErrorsModel))
|
||||
{
|
||||
List<MessageInSendTaxDto> inquiryerrorResult = JsonConvert.DeserializeObject<List<MessageInSendTaxDto>>(item.ErrorsModel);
|
||||
// if (item.SentStatus == SentStatus.Unsuccessful && !string.IsNullOrEmpty(item.ErrorsModel))
|
||||
// {
|
||||
// List<MessageInSendTaxDto> inquiryerrorResult = JsonConvert.DeserializeObject<List<MessageInSendTaxDto>>(item.ErrorsModel);
|
||||
|
||||
InquiryResultModel inquiryResult = JsonConvert.DeserializeObject<InquiryResultModel>(item.InquiryResultModel);
|
||||
if (inquiryResult.Data != null)
|
||||
{
|
||||
// InquiryResultModel inquiryResult = JsonConvert.DeserializeObject<InquiryResultModel>(item.InquiryResultModel);
|
||||
// if (inquiryResult.Data != null)
|
||||
// {
|
||||
|
||||
desData = new DataInSendTaxDto();
|
||||
desData.SentStatus = SentStatus.Unsuccessful;
|
||||
desData.error = inquiryerrorResult;
|
||||
// desData = new DataInSendTaxDto();
|
||||
// desData.SentStatus = SentStatus.Unsuccessful;
|
||||
// desData.error = inquiryerrorResult;
|
||||
|
||||
|
||||
|
||||
}
|
||||
return Ok(desData);
|
||||
}
|
||||
else if (item.SentStatus == SentStatus.Send
|
||||
|| item.SentStatus == SentStatus.pending
|
||||
|| item.SentStatus == SentStatus.IN_PROGRESS
|
||||
|| item.SentStatus == SentStatus.Unsuccessful)
|
||||
{
|
||||
// }
|
||||
// return Ok(desData);
|
||||
// }
|
||||
// else if (item.SentStatus == SentStatus.Send
|
||||
// || item.SentStatus == SentStatus.pending
|
||||
// || item.SentStatus == SentStatus.IN_PROGRESS
|
||||
// || item.SentStatus == SentStatus.Unsuccessful)
|
||||
// {
|
||||
|
||||
//ta imja
|
||||
var result = await _actionTaxPayer.GetResultByUid(user.RolUsers.First().CompanyID, item.uId);
|
||||
if (result == null)
|
||||
return BadRequest(new List<string> { "پاسخی از سازمان دریافت نشد" });
|
||||
// //ta imja
|
||||
// var result = await _actionTaxPayer.GetResultByUid(user.RolUsers.First().CompanyID, item.uId);
|
||||
// if (result == null)
|
||||
// return BadRequest(new List<string> { "پاسخی از سازمان دریافت نشد" });
|
||||
|
||||
else
|
||||
{
|
||||
item.InquiryResultModel = JsonConvert.SerializeObject(result);
|
||||
if (result.Data != null)
|
||||
{
|
||||
desData = JsonConvert.DeserializeObject<DataInSendTaxDto>(result.Data.ToString());
|
||||
if (desData == null)
|
||||
{
|
||||
desData = new DataInSendTaxDto();
|
||||
desData.error = JsonConvert.DeserializeObject<List<MessageInSendTaxDto>>(result.Data.ToString());
|
||||
}
|
||||
}
|
||||
// else
|
||||
// {
|
||||
// item.InquiryResultModel = JsonConvert.SerializeObject(result);
|
||||
// if (result.Data != null)
|
||||
// {
|
||||
// desData = JsonConvert.DeserializeObject<DataInSendTaxDto>(result.Data.ToString());
|
||||
// if (desData == null)
|
||||
// {
|
||||
// desData = new DataInSendTaxDto();
|
||||
// desData.error = JsonConvert.DeserializeObject<List<MessageInSendTaxDto>>(result.Data.ToString());
|
||||
// }
|
||||
// }
|
||||
|
||||
desData.SentStatus = item.SentStatus =
|
||||
result.Status == "FAILED" ? SentStatus.Unsuccessful
|
||||
: result.Status == "PENDING" ? SentStatus.pending
|
||||
: result.Status == "SUCCESS" ? SentStatus.Successful
|
||||
: result.Status == "NOT_FOUND" ? SentStatus.NOT_FOUND
|
||||
: result.Status == "IN_PROGRESS" ? SentStatus.IN_PROGRESS
|
||||
: SentStatus.Unknown;
|
||||
// desData.SentStatus = item.SentStatus =
|
||||
// result.Status == "FAILED" ? SentStatus.Unsuccessful
|
||||
// : result.Status == "PENDING" ? SentStatus.pending
|
||||
// : result.Status == "SUCCESS" ? SentStatus.Successful
|
||||
// : result.Status == "NOT_FOUND" ? SentStatus.NOT_FOUND
|
||||
// : result.Status == "IN_PROGRESS" ? SentStatus.IN_PROGRESS
|
||||
// : SentStatus.Unknown;
|
||||
|
||||
if (item.SentStatus == SentStatus.Unsuccessful)
|
||||
item.ErrorsModel = JsonConvert.SerializeObject(desData.error);
|
||||
}
|
||||
// if (item.SentStatus == SentStatus.Unsuccessful)
|
||||
// item.ErrorsModel = JsonConvert.SerializeObject(desData.error);
|
||||
// }
|
||||
|
||||
|
||||
if (await _servTaxPayer.UpdateSentTax(item)) return Ok(desData);
|
||||
// if (await _servTaxPayer.UpdateSentTax(item)) return Ok(desData);
|
||||
|
||||
else return BadRequest(new List<string> { "خطای در ذخیره سازی" });
|
||||
}
|
||||
return BadRequest(new List<string> { "در این وضعیت امکان پذیر نمی باشد" });
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(new List<string> { "خطای ناشناخته" });
|
||||
}
|
||||
// else return BadRequest(new List<string> { "خطای در ذخیره سازی" });
|
||||
// }
|
||||
// return BadRequest(new List<string> { "در این وضعیت امکان پذیر نمی باشد" });
|
||||
//}
|
||||
//catch (Exception ex)
|
||||
//{
|
||||
// return BadRequest(new List<string> { "خطای ناشناخته" });
|
||||
//}
|
||||
}
|
||||
[HttpGet("GetBillTypes")]
|
||||
public async Task<ActionResult<List<IdName<int>>>> GetBillTypes()
|
||||
@@ -585,26 +579,30 @@ namespace Back.Controllers
|
||||
[HttpGet("EconomicCodeInformation")]
|
||||
public async Task<ActionResult<EconomicCodeModelDto>> GetEconomicCodeInformation(string item)
|
||||
{
|
||||
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> { "خطا در احراز هویت سازمان مالیاتی" });
|
||||
var result=await _actionTaxPayer.GetEconomicCodeInformation(item);
|
||||
if (result == null) return NotFound();
|
||||
return Ok(result);
|
||||
return BadRequest(new List<string> { "در حال حاضر سامانه مودیان در دسترس نمی باشد" });
|
||||
|
||||
//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> { "خطا در احراز هویت سازمان مالیاتی" });
|
||||
//var result=await _actionTaxPayer.GetEconomicCodeInformation(item);
|
||||
//if (result == null) return NotFound();
|
||||
//return Ok(result);
|
||||
}
|
||||
[HttpGet("FiscalInformation")]
|
||||
public async Task<ActionResult<FiscalInformationModelDto>> GetFiscalInformation(string item)
|
||||
{
|
||||
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> { "خطا در احراز هویت سازمان مالیاتی" });
|
||||
var result=await _actionTaxPayer.GetFiscalInformation(item);
|
||||
if (result == null) return NotFound();
|
||||
return Ok(result);
|
||||
return BadRequest(new List<string> { "در حال حاضر سامانه مودیان در دسترس نمی باشد" });
|
||||
|
||||
//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> { "خطا در احراز هویت سازمان مالیاتی" });
|
||||
//var result=await _actionTaxPayer.GetFiscalInformation(item);
|
||||
//if (result == null) return NotFound();
|
||||
//return Ok(result);
|
||||
}
|
||||
[HttpGet("CodInTaxPayerHaveBeenSentSuccessfully/{CODID}")]
|
||||
public async Task<ActionResult<bool>> CodInTaxPayerHaveBeenSentSuccessfully(int CODID)
|
||||
|
@@ -3,7 +3,6 @@ using Back.Services;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Newtonsoft.Json;
|
||||
using Shared.DTOs;
|
||||
using Shared.DTOs.Serch;
|
||||
|
||||
|
@@ -3,7 +3,6 @@ using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Text.Json.Serialization;
|
||||
using Back.Common;
|
||||
using Shared.DTOs;
|
||||
using TaxCollectData.Library.Dto.Content;
|
||||
namespace Back.Data.Models
|
||||
{
|
||||
public class Invoice : ICloneable
|
||||
|
15
Back/DockerCommand.txt
Normal file
15
Back/DockerCommand.txt
Normal file
@@ -0,0 +1,15 @@
|
||||
from run E:\TaxPayerFULL
|
||||
|
||||
docker build -f back\Dockerfile -t api_moadiran .
|
||||
docker run --name api_moadiran -d -p 3201:8080 api_moadiran
|
||||
|
||||
یکی از مشکلات این پروژه یکی کنابخانه سامانه مودیان بود که وقتی خود کنابخانه رو ریختیم کنار پروژه و در داکزفایل آدرسشو دادیم درست شد ولی ما کلا حذفش کردیم
|
||||
یکی هم taxtools بود که اونم باید میومد کنار پروؤه ولی ما فعلا خذفش کردیم
|
||||
|
||||
کلا داکر نمیتونه به درایو ها دسترسی داشته باشه همه چی باید در خود پروژه باشه
|
||||
|
||||
--------------------------------------------------------------------------------------------
|
||||
in local => docker build -f back\Dockerfile -t mmrbnjd/api_moadiran:latest .
|
||||
in local => docker push mmrbnjd/api_moadiran:latest
|
||||
in server => docker pull mmrbnjd/api_moadiran:latest
|
||||
in server => docker run -d -p 3201:8080 --restart always mmrbnjd/api_moadiran:latest
|
30
Back/Dockerfile
Normal file
30
Back/Dockerfile
Normal file
@@ -0,0 +1,30 @@
|
||||
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
|
||||
WORKDIR /app
|
||||
EXPOSE 8080
|
||||
|
||||
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
|
||||
ARG BUILD_CONFIGURATION=Release
|
||||
WORKDIR /src
|
||||
|
||||
# کپی csproj ها
|
||||
COPY Back/Back.csproj Back/
|
||||
COPY Shared/Shared.csproj Shared/
|
||||
|
||||
# کپی کردن سورس لوکال و NuGet.config (از داخل Back)
|
||||
#COPY Back/NuGet.config ./
|
||||
#COPY Back/LocalPackages ./LocalPackages
|
||||
|
||||
RUN dotnet restore "./Back/Back.csproj"
|
||||
|
||||
COPY . .
|
||||
WORKDIR "/src/Back"
|
||||
RUN dotnet build "./Back.csproj" -c $BUILD_CONFIGURATION -o /app/build
|
||||
|
||||
FROM build AS publish
|
||||
ARG BUILD_CONFIGURATION=Release
|
||||
RUN dotnet publish "./Back.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
|
||||
|
||||
FROM base AS final
|
||||
WORKDIR /app
|
||||
COPY --from=publish /app/publish .
|
||||
ENTRYPOINT ["dotnet", "Back.dll"]
|
@@ -1,25 +1,24 @@
|
||||
using Newtonsoft.Json.Serialization;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
using System.Reflection;
|
||||
|
||||
namespace Back.Features
|
||||
{
|
||||
public class IgnorePropertiesResolver : DefaultContractResolver
|
||||
{
|
||||
private readonly HashSet<string> ignoreProps;
|
||||
public IgnorePropertiesResolver(IEnumerable<string> propNamesToIgnore)
|
||||
{
|
||||
this.ignoreProps = new HashSet<string>(propNamesToIgnore);
|
||||
}
|
||||
//public class IgnorePropertiesResolver : DefaultContractResolver
|
||||
//{
|
||||
// private readonly HashSet<string> ignoreProps;
|
||||
// public IgnorePropertiesResolver(IEnumerable<string> propNamesToIgnore)
|
||||
// {
|
||||
// this.ignoreProps = new HashSet<string>(propNamesToIgnore);
|
||||
// }
|
||||
|
||||
protected override JsonProperty CreateProperty(MemberInfo member, MemberSerialization memberSerialization)
|
||||
{
|
||||
JsonProperty property = base.CreateProperty(member, memberSerialization);
|
||||
if (this.ignoreProps.Contains(property.PropertyName))
|
||||
{
|
||||
property.ShouldSerialize = _ => false;
|
||||
}
|
||||
return property;
|
||||
}
|
||||
}
|
||||
// protected override JsonProperty CreateProperty(MemberInfo member, MemberSerialization memberSerialization)
|
||||
// {
|
||||
// JsonProperty property = base.CreateProperty(member, memberSerialization);
|
||||
// if (this.ignoreProps.Contains(property.PropertyName))
|
||||
// {
|
||||
// property.ShouldSerialize = _ => false;
|
||||
// }
|
||||
// return property;
|
||||
// }
|
||||
//}
|
||||
}
|
||||
|
7
Back/NuGet.config
Normal file
7
Back/NuGet.config
Normal file
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<packageSources>
|
||||
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
|
||||
<add key="local" value="./LocalPackages" />
|
||||
</packageSources>
|
||||
</configuration>
|
@@ -55,7 +55,7 @@ builder.Services.AddScoped(typeof(IAsyncRepository<>), typeof(RepositoryBase<>))
|
||||
builder.Services.AddScoped(typeof(RepositoryBase<>), typeof(RepositoryBase<>));
|
||||
builder.Services.AddScoped<Back.Services.ServBase>();
|
||||
builder.Services.AddScoped<MobileValidation> ();
|
||||
builder.Services.AddScoped<Service.Main>();
|
||||
//builder.Services.AddScoped<Service.Main>();
|
||||
builder.Services.AddScoped<servTicket > ();
|
||||
builder.Services.AddScoped<ServValidatinMsg>();
|
||||
builder.Services.AddScoped<GetVerificationValidation> ();
|
||||
@@ -104,10 +104,11 @@ builder.Services.AddCors(options =>
|
||||
options.AddPolicy(origins,
|
||||
policy =>
|
||||
{
|
||||
policy.WithOrigins("https://localhost:7224", "http://localhost:5107"
|
||||
, "http://195.88.208.142", "http://moadiran.ir"
|
||||
, "https://195.88.208.142", "https://moadiran.ir"
|
||||
, "https://195.88.208.142:440", "https://moadiran.ir:440", "https://localhost:44346")
|
||||
policy.AllowAnyOrigin()
|
||||
//.WithOrigins("https://localhost:7224", "http://localhost:5107"
|
||||
// , "http://195.88.208.142", "http://moadiran.ir"
|
||||
// , "https://195.88.208.142", "https://moadiran.ir"
|
||||
//, "https://195.88.208.142:440", "https://moadiran.ir:440", "https://localhost:44346")
|
||||
.AllowAnyHeader()
|
||||
.WithHeaders(HeaderNames.ContentType)
|
||||
.AllowAnyMethod();
|
||||
@@ -135,7 +136,7 @@ builder.Services.AddAuthentication("Bearer")
|
||||
var app = builder.Build();
|
||||
|
||||
// Configure the HTTP request pipeline.
|
||||
if (app.Environment.IsDevelopment())
|
||||
if (true || app.Environment.IsDevelopment())
|
||||
{
|
||||
app.UseSwagger();
|
||||
app.UseSwaggerUI();
|
||||
|
@@ -27,6 +27,17 @@
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"Container (Dockerfile)": {
|
||||
"commandName": "Docker",
|
||||
"launchBrowser": true,
|
||||
"launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}/swagger",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_HTTPS_PORTS": "8081",
|
||||
"ASPNETCORE_HTTP_PORTS": "8080"
|
||||
},
|
||||
"publishAllPorts": true,
|
||||
"useSSL": true
|
||||
}
|
||||
},
|
||||
"$schema": "http://json.schemastore.org/launchsettings.json",
|
||||
|
@@ -1,13 +1,8 @@
|
||||
using Back.Common;
|
||||
using Microsoft.IdentityModel.Tokens;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
using Shared.DTOs;
|
||||
using TaxCollectData.Library.Business;
|
||||
using TaxCollectData.Library.Dto.Config;
|
||||
using TaxCollectData.Library.Dto.Content;
|
||||
using TaxCollectData.Library.Dto.Properties;
|
||||
using TaxCollectData.Library.Dto.Transfer;
|
||||
using TaxCollectData.Library.Enums;
|
||||
|
||||
|
||||
namespace Back.Services
|
||||
{
|
||||
@@ -26,77 +21,77 @@ namespace Back.Services
|
||||
|
||||
public string GenerateTaxid(string FactorNo, string InvoiceDate)
|
||||
{
|
||||
//return "testTaxid";
|
||||
return TaxApiService.Instance.TaxIdGenerator.GenerateTaxId(_UniqueMemory,
|
||||
Convert.ToInt64(FactorNo), InvoiceDate.ToMiladi());
|
||||
return "testTaxid";
|
||||
//return TaxApiService.Instance.TaxIdGenerator.GenerateTaxId(_UniqueMemory,
|
||||
// Convert.ToInt64(FactorNo), InvoiceDate.ToMiladi());
|
||||
}
|
||||
public async Task<InquiryResultModel> GetResultByUid(int CompanyID, string uid)
|
||||
{
|
||||
//public async Task<InquiryResultModel> GetResultByUid(int CompanyID, string uid)
|
||||
//{
|
||||
|
||||
var uidAndFiscalId = new UidAndFiscalId(uid, _UniqueMemory);
|
||||
var inquiryResultModels = TaxApiService.Instance.TaxApis.InquiryByUidAndFiscalId(new() { uidAndFiscalId });
|
||||
if (inquiryResultModels.Count > 0)
|
||||
return inquiryResultModels[0];
|
||||
return null;
|
||||
}
|
||||
public async Task<TaxCollectData.Library.Dto.HttpResponse<AsyncResponseModel>> SendInvoice(int CompanyID,InvoiceHeaderDto header, List<InvoiceBodyDto> InvoiceBody, List<PaymentDto> payments)
|
||||
{
|
||||
return await TaxApiService.Instance.TaxApis.SendInvoicesAsync(new List<InvoiceDto>()
|
||||
{
|
||||
new()
|
||||
{
|
||||
Header =header,Body =InvoiceBody,Payments = payments
|
||||
}
|
||||
}
|
||||
, null);
|
||||
}
|
||||
public async Task<EconomicCodeModel?> GetEconomicCodeInformation(string Item)
|
||||
{
|
||||
// var uidAndFiscalId = new UidAndFiscalId(uid, _UniqueMemory);
|
||||
// var inquiryResultModels = TaxApiService.Instance.TaxApis.InquiryByUidAndFiscalId(new() { uidAndFiscalId });
|
||||
// if (inquiryResultModels.Count > 0)
|
||||
// return inquiryResultModels[0];
|
||||
// return null;
|
||||
//}
|
||||
//public async Task<TaxCollectData.Library.Dto.HttpResponse<AsyncResponseModel>> SendInvoice(int CompanyID,InvoiceHeaderDto header, List<InvoiceBodyDto> InvoiceBody, List<PaymentDto> payments)
|
||||
//{
|
||||
// return await TaxApiService.Instance.TaxApis.SendInvoicesAsync(new List<InvoiceDto>()
|
||||
// {
|
||||
// new()
|
||||
// {
|
||||
// Header =header,Body =InvoiceBody,Payments = payments
|
||||
// }
|
||||
// }
|
||||
// , null);
|
||||
//}
|
||||
//public async Task<EconomicCodeModel?> GetEconomicCodeInformation(string Item)
|
||||
//{
|
||||
|
||||
return await TaxApiService.Instance.TaxApis.GetEconomicCodeInformationAsync(Item);
|
||||
// return await TaxApiService.Instance.TaxApis.GetEconomicCodeInformationAsync(Item);
|
||||
|
||||
|
||||
}
|
||||
public async Task<FiscalInformationModel?> GetFiscalInformation(string Item)
|
||||
{
|
||||
return await TaxApiService.Instance.TaxApis.GetFiscalInformationAsync(Item);
|
||||
}
|
||||
//}
|
||||
//public async Task<FiscalInformationModel?> GetFiscalInformation(string Item)
|
||||
//{
|
||||
// return await TaxApiService.Instance.TaxApis.GetFiscalInformationAsync(Item);
|
||||
//}
|
||||
//-------------------internal
|
||||
public async Task<bool> login(int CompanyID)
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
#region TokenTax
|
||||
var resquth = await _servCompany.GetTaxAuth(CompanyID);
|
||||
if (string.IsNullOrEmpty(resquth.UniqueMemory) || string.IsNullOrEmpty(resquth.PrivateKey))
|
||||
return false;
|
||||
//try
|
||||
//{
|
||||
// #region TokenTax
|
||||
// var resquth = await _servCompany.GetTaxAuth(CompanyID);
|
||||
// if (string.IsNullOrEmpty(resquth.UniqueMemory) || string.IsNullOrEmpty(resquth.PrivateKey))
|
||||
// return false;
|
||||
|
||||
if (!string.IsNullOrEmpty(resquth.UniqueMemory) && !string.IsNullOrEmpty(resquth.PrivateKey))
|
||||
{
|
||||
// if (!string.IsNullOrEmpty(resquth.UniqueMemory) && !string.IsNullOrEmpty(resquth.PrivateKey))
|
||||
// {
|
||||
|
||||
//string taxapi = _configuration.GetSection("TaxPayerApi").Value;
|
||||
string taxapi = "https://sandboxrc.tax.gov.ir/req/api/";
|
||||
_UniqueMemory = resquth.UniqueMemory;
|
||||
_PrivateKey = resquth.PrivateKey;
|
||||
TaxApiService.Instance.Init(_UniqueMemory,
|
||||
new SignatoryConfig(_PrivateKey, null),
|
||||
new NormalProperties(ClientType.SELF_TSP), taxapi);
|
||||
await TaxApiService.Instance.TaxApis.GetServerInformationAsync();
|
||||
}
|
||||
#endregion
|
||||
// //string taxapi = _configuration.GetSection("TaxPayerApi").Value;
|
||||
// string taxapi = "https://sandboxrc.tax.gov.ir/req/api/";
|
||||
// _UniqueMemory = resquth.UniqueMemory;
|
||||
// _PrivateKey = resquth.PrivateKey;
|
||||
// TaxApiService.Instance.Init(_UniqueMemory,
|
||||
// new SignatoryConfig(_PrivateKey, null),
|
||||
// new NormalProperties(ClientType.SELF_TSP), taxapi);
|
||||
// await TaxApiService.Instance.TaxApis.GetServerInformationAsync();
|
||||
// }
|
||||
// #endregion
|
||||
|
||||
if (TaxApiService.Instance.TaxApis.GetToken() is null)
|
||||
{
|
||||
if (await TaxApiService.Instance.TaxApis.RequestTokenAsync() == null)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
// if (TaxApiService.Instance.TaxApis.GetToken() is null)
|
||||
// {
|
||||
// if (await TaxApiService.Instance.TaxApis.RequestTokenAsync() == null)
|
||||
// return false;
|
||||
// }
|
||||
// return true;
|
||||
//}
|
||||
//catch (Exception)
|
||||
//{
|
||||
// return false;
|
||||
//}
|
||||
|
||||
}
|
||||
|
||||
|
@@ -16,15 +16,15 @@ namespace Back.Services
|
||||
private readonly IAsyncRepository<Blog> _repoBlog;
|
||||
private readonly IAsyncRepository<Question> _repoQuestion;
|
||||
private readonly IAsyncRepository<SaleLead> _repoSaleLead;
|
||||
private readonly Service.Main _Taxtools;
|
||||
// private readonly Service.Main _Taxtools;
|
||||
public ServBase(IAsyncRepository<Pricing> repoPricing,
|
||||
IAsyncRepository<Blog> repoBlog, IAsyncRepository<Question> repoQuestion
|
||||
, Service.Main taxtools, IAsyncRepository<SaleLead> repoSaleLead)
|
||||
/* , Service.Main taxtools*/, IAsyncRepository<SaleLead> repoSaleLead)
|
||||
{
|
||||
_repoPricing = repoPricing;
|
||||
_repoBlog = repoBlog;
|
||||
_repoQuestion = repoQuestion;
|
||||
_Taxtools = taxtools;
|
||||
// _Taxtools = taxtools;
|
||||
_repoSaleLead = repoSaleLead;
|
||||
}
|
||||
public async Task<List<BasePriceDto>> GetBasePrice()
|
||||
@@ -89,63 +89,63 @@ namespace Back.Services
|
||||
public async Task<TaxToolsDTO?> CreateCsrAndPrivateKey(CsrPrivateKeyDto model)
|
||||
{
|
||||
TaxToolsDTO taxTools = null;
|
||||
List<Service.PrmValue> values = new List<Service.PrmValue>()
|
||||
{
|
||||
new Service.PrmValue(){Prm="CN",Value=model.cn},
|
||||
new Service.PrmValue(){Prm="serialNumber",Value=model.sn},
|
||||
new Service.PrmValue(){Prm="O",Value="Non-Governmental"},
|
||||
new Service.PrmValue(){Prm="3.OU",Value=model.company},
|
||||
new Service.PrmValue(){Prm="2.OU",Value=model.company},
|
||||
new Service.PrmValue(){Prm="1.OU",Value=model.company},
|
||||
new Service.PrmValue(){Prm="C",Value="IR"},
|
||||
};
|
||||
string msg = "";
|
||||
if (_Taxtools.CraeteCnfFile(values, ref msg))
|
||||
{
|
||||
if (_Taxtools.CreateCsrAndPrivateKey(model.cn, ref msg))
|
||||
{
|
||||
taxTools = new TaxToolsDTO();
|
||||
//خواندن
|
||||
Stream stream = File.Open($"C:\\OpenSSL\\bin\\{model.cn}.Csr", FileMode.Open);
|
||||
byte[] buffer = new byte[stream.Length];
|
||||
stream.Read(buffer, 0, (int)stream.Length);
|
||||
string csr = Encoding.UTF8.GetString(buffer);
|
||||
stream.Flush();
|
||||
stream.Close();
|
||||
taxTools.Base64csr = Convert.ToBase64String(buffer);
|
||||
taxTools.typecsr = "Csr";
|
||||
stream = File.Open($"C:\\OpenSSL\\bin\\{model.cn}.key", FileMode.Open);
|
||||
buffer = new byte[stream.Length];
|
||||
stream.Read(buffer, 0, (int)stream.Length);
|
||||
string key = Encoding.UTF8.GetString(buffer);
|
||||
taxTools.Base64key = Convert.ToBase64String(buffer);
|
||||
taxTools.typekey = "key";
|
||||
stream.Flush();
|
||||
stream.Close();
|
||||
|
||||
//_contextMongodb.InsertItem(new SysLog()
|
||||
//List<Service.PrmValue> values = new List<Service.PrmValue>()
|
||||
//{
|
||||
// TraceIdentifierID = _httpContextAccessor.HttpContext.TraceIdentifier,
|
||||
// Datetime = DateTime.Now.ConvertMiladiToShamsi(),
|
||||
// Method = $"{_httpContextAccessor.HttpContext.Request.Method}/{this.GetType().FullName}/CreateCsrAndPrivateKey",
|
||||
// Value = JsonConvert.SerializeObject(model),
|
||||
// Route = _httpContextAccessor.HttpContext.Request.Path,
|
||||
// Type = "User"
|
||||
//});
|
||||
await _repoSaleLead.AddAsync(new SaleLead
|
||||
{
|
||||
cn = model.cn,
|
||||
company = model.company,
|
||||
csr = csr,
|
||||
Key = key,
|
||||
Mobile = model.Mobile,
|
||||
sn = model.sn
|
||||
});
|
||||
}
|
||||
// new Service.PrmValue(){Prm="CN",Value=model.cn},
|
||||
// new Service.PrmValue(){Prm="serialNumber",Value=model.sn},
|
||||
// new Service.PrmValue(){Prm="O",Value="Non-Governmental"},
|
||||
// new Service.PrmValue(){Prm="3.OU",Value=model.company},
|
||||
// new Service.PrmValue(){Prm="2.OU",Value=model.company},
|
||||
// new Service.PrmValue(){Prm="1.OU",Value=model.company},
|
||||
// new Service.PrmValue(){Prm="C",Value="IR"},
|
||||
//};
|
||||
//string msg = "";
|
||||
//if (_Taxtools.CraeteCnfFile(values, ref msg))
|
||||
//{
|
||||
// if (_Taxtools.CreateCsrAndPrivateKey(model.cn, ref msg))
|
||||
// {
|
||||
// taxTools = new TaxToolsDTO();
|
||||
// //خواندن
|
||||
// Stream stream = File.Open($"C:\\OpenSSL\\bin\\{model.cn}.Csr", FileMode.Open);
|
||||
// byte[] buffer = new byte[stream.Length];
|
||||
// stream.Read(buffer, 0, (int)stream.Length);
|
||||
// string csr = Encoding.UTF8.GetString(buffer);
|
||||
// stream.Flush();
|
||||
// stream.Close();
|
||||
// taxTools.Base64csr = Convert.ToBase64String(buffer);
|
||||
// taxTools.typecsr = "Csr";
|
||||
// stream = File.Open($"C:\\OpenSSL\\bin\\{model.cn}.key", FileMode.Open);
|
||||
// buffer = new byte[stream.Length];
|
||||
// stream.Read(buffer, 0, (int)stream.Length);
|
||||
// string key = Encoding.UTF8.GetString(buffer);
|
||||
// taxTools.Base64key = Convert.ToBase64String(buffer);
|
||||
// taxTools.typekey = "key";
|
||||
// stream.Flush();
|
||||
// stream.Close();
|
||||
|
||||
}
|
||||
// //_contextMongodb.InsertItem(new SysLog()
|
||||
// //{
|
||||
// // TraceIdentifierID = _httpContextAccessor.HttpContext.TraceIdentifier,
|
||||
// // Datetime = DateTime.Now.ConvertMiladiToShamsi(),
|
||||
// // Method = $"{_httpContextAccessor.HttpContext.Request.Method}/{this.GetType().FullName}/CreateCsrAndPrivateKey",
|
||||
// // Value = JsonConvert.SerializeObject(model),
|
||||
// // Route = _httpContextAccessor.HttpContext.Request.Path,
|
||||
// // Type = "User"
|
||||
// //});
|
||||
// await _repoSaleLead.AddAsync(new SaleLead
|
||||
// {
|
||||
// cn = model.cn,
|
||||
// company = model.company,
|
||||
// csr = csr,
|
||||
// Key = key,
|
||||
// Mobile = model.Mobile,
|
||||
// sn = model.sn
|
||||
// });
|
||||
// }
|
||||
|
||||
if (string.IsNullOrEmpty(msg))
|
||||
//}
|
||||
|
||||
// if (string.IsNullOrEmpty(msg))
|
||||
{
|
||||
//_contextMongodb.InsertItem(new SysLog()
|
||||
//{
|
||||
|
@@ -4,7 +4,6 @@ using Back.Data.Infrastructure.Repository;
|
||||
using Back.Data.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.IdentityModel.Tokens;
|
||||
using Org.BouncyCastle.Crypto.Tls;
|
||||
using Shared.DTOs;
|
||||
using System.ComponentModel.Design;
|
||||
using System.Data.SqlTypes;
|
||||
|
@@ -5,7 +5,6 @@ using Back.Services;
|
||||
using FluentValidation;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Shared.DTOs;
|
||||
using TaxCollectData.Library.Dto.Content;
|
||||
|
||||
namespace Back.Validations
|
||||
{
|
||||
|
@@ -1,9 +1,8 @@
|
||||
using FluentValidation;
|
||||
using TaxCollectData.Library.Dto.Content;
|
||||
|
||||
namespace Back.Validations
|
||||
{
|
||||
public class TaxSystemRules : AbstractValidator<Tuple<InvoiceHeaderDto, List<InvoiceBodyDto>, PaymentDto>>
|
||||
{
|
||||
}
|
||||
//public class TaxSystemRules : AbstractValidator<Tuple<InvoiceHeaderDto, List<InvoiceBodyDto>, PaymentDto>>
|
||||
//{
|
||||
//}
|
||||
}
|
||||
|
@@ -1,7 +1,6 @@
|
||||
using Back.Data.Contracts;
|
||||
using FluentValidation;
|
||||
using Shared.DTOs.Warehouse;
|
||||
using Net.Pkcs11Interop.Common;
|
||||
using Back.Services;
|
||||
using Back.Data.Models;
|
||||
using Back.Common;
|
||||
|
@@ -6,5 +6,14 @@
|
||||
}
|
||||
},
|
||||
"AllowedHosts": "*",
|
||||
"TaxPayerApi": "https://tp.tax.gov.ir/req/api/"
|
||||
"TaxPayerApi": "https://tp.tax.gov.ir/req/api/",
|
||||
"ConnectionStrings": {
|
||||
"Base": "Data Source=195.88.208.142;Initial Catalog=TaxPayer020713;User ID=sa;Password=M439610m@;TrustServerCertificate=True"
|
||||
|
||||
},
|
||||
"Fixedvalues": {
|
||||
"Jwt_Lifetime_Minutes": "144000"
|
||||
},
|
||||
"CreateReportFileName": "E:\\CreateReport\\CreateReport.exe",
|
||||
"ReportLog": "E:\\Report\\log.txt"
|
||||
}
|
||||
|
10
TaxPayerFull/DockerCommand.txt
Normal file
10
TaxPayerFull/DockerCommand.txt
Normal file
@@ -0,0 +1,10 @@
|
||||
from run E:\TaxPayerFULL
|
||||
docker build -f TaxPayerFULL\Dockerfile -t app_moadiran .
|
||||
docker run --name app_moadiran -d -p 82:5107 app_moadiran
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------------------
|
||||
in local => docker build -f TaxPayerFULL\Dockerfile -t mmrbnjd/app_moadiran:latest .
|
||||
in local => docker push mmrbnjd/app_moadiran:latest
|
||||
in server => docker pull mmrbnjd/app_moadiran:latest
|
||||
in server => docker run -d -p 3102:5107 --restart always mmrbnjd/app_moadiran:latest
|
98
TaxPayerFull/Dockerfile
Normal file
98
TaxPayerFull/Dockerfile
Normal file
@@ -0,0 +1,98 @@
|
||||
# مرحله ۱: Build پروژه Blazor WASM با .NET 9
|
||||
# اینجا باید از SDK استفاده کنید نه aspnet
|
||||
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build
|
||||
WORKDIR /src
|
||||
|
||||
# نصب وابستگیها برای emscripten (python3 + سایر ابزارها)
|
||||
RUN apt-get update && apt-get install -y python3 make cmake clang zlib1g-dev \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# کپی کردن فایلهای پروژه
|
||||
COPY TaxPayerFull/Front.csproj Front/
|
||||
COPY Shared/Shared.csproj Shared/
|
||||
COPY . .
|
||||
|
||||
# پاکسازی workloadهای قدیمی (اختیاری)
|
||||
RUN dotnet workload clean
|
||||
|
||||
# نصب wasm-tools برای Blazor
|
||||
RUN dotnet workload install wasm-tools
|
||||
|
||||
# انتشار (Publish) خروجی در حالت Release
|
||||
RUN dotnet publish "TaxPayerFull/Front.csproj" -c Release -o /app \
|
||||
-p:TreatWarningsAsErrors=false \
|
||||
-p:RunAOTCompilation=false \
|
||||
-p:PublishTrimmed=false
|
||||
|
||||
# مرحله ۲: سرو کردن با Nginx
|
||||
FROM nginx:alpine AS final
|
||||
WORKDIR /usr/share/nginx/html
|
||||
|
||||
# حذف محتوای پیشفرض nginx
|
||||
RUN rm -rf ./*
|
||||
|
||||
# کپی خروجی Blazor WASM
|
||||
COPY --from=build /app/wwwroot ./
|
||||
|
||||
# فقط بلوک server داخل default.conf
|
||||
RUN printf 'server {\n\
|
||||
listen 5107;\n\
|
||||
server_name localhost;\n\
|
||||
\n\
|
||||
root /usr/share/nginx/html;\n\
|
||||
index index.html;\n\
|
||||
\n\
|
||||
location / {\n\
|
||||
try_files $uri $uri/ /index.html;\n\
|
||||
}\n\
|
||||
|
||||
\n\
|
||||
location /_framework/ {\n\
|
||||
expires 1y;\n\
|
||||
add_header Cache-Control "public, immutable";\n\
|
||||
}\n\
|
||||
\n\
|
||||
location /_content/ {\n\
|
||||
expires 1y;\n\
|
||||
add_header Cache-Control "public, immutable";\n\
|
||||
}\n\
|
||||
\n\
|
||||
location /assets/ {\n\
|
||||
expires 7d;\n\
|
||||
add_header Cache-Control "public";\n\
|
||||
}\n\
|
||||
\n\
|
||||
location /css/ {\n\
|
||||
expires 7d;\n\
|
||||
add_header Cache-Control "public";\n\
|
||||
}\n\
|
||||
\n\
|
||||
location /fonts/ {\n\
|
||||
expires 7d;\n\
|
||||
add_header Cache-Control "public";\n\
|
||||
}\n\
|
||||
\n\
|
||||
location /img/ {\n\
|
||||
expires 7d;\n\
|
||||
add_header Cache-Control "public";\n\
|
||||
}\n\
|
||||
\n\
|
||||
location /js/ {\n\
|
||||
expires 7d;\n\
|
||||
add_header Cache-Control "public";\n\
|
||||
}\n\
|
||||
\n\
|
||||
location ~ \\.dll$ { add_header Content-Type application/octet-stream; }\n\
|
||||
location ~ \\.wasm$ { add_header Content-Type application/wasm; }\n\
|
||||
location ~ \\.pdb$ { add_header Content-Type application/octet-stream; }\n\
|
||||
location ~ \\.dat$ { add_header Content-Type application/octet-stream; }\n\
|
||||
\n\
|
||||
gzip on;\n\
|
||||
gzip_types text/plain application/xml text/css application/javascript application/json application/wasm;\n\
|
||||
gzip_min_length 256;\n\
|
||||
\n\
|
||||
error_page 404 /index.html;\n\
|
||||
}' > /etc/nginx/conf.d/default.conf
|
||||
|
||||
EXPOSE 5107
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
@@ -31,13 +31,14 @@ builder.Services.AddScoped(sp => new UserAuthenticationDTO()
|
||||
enterDate =new DateTime(),
|
||||
exitDate = new DateTime(),
|
||||
}) ;
|
||||
|
||||
string BaseAddress = builder.Configuration.GetSection("BaseAddress").Value;
|
||||
builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(BaseAddress) });
|
||||
// Server
|
||||
//builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri("http://195.88.208.142:7075/api/") });
|
||||
//builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri("https://moadiran.ir:444/api/") });
|
||||
|
||||
//Home
|
||||
builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri("http://localhost:5271/api/") });
|
||||
//builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri("http://localhost:5271/api/") });
|
||||
|
||||
//farzan
|
||||
//builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri("https://localhost:7075/api/") });
|
||||
|
21
TaxPayerFull/default.conf
Normal file
21
TaxPayerFull/default.conf
Normal file
@@ -0,0 +1,21 @@
|
||||
server {
|
||||
listen 8084;
|
||||
server_name localhost;
|
||||
|
||||
root /usr/share/nginx/html;
|
||||
index index.html;
|
||||
|
||||
location / {
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
|
||||
location ~* \.(?:ico|css|js|gif|jpe?g|png|woff2?|eot|ttf|svg)$ {
|
||||
expires 6M;
|
||||
access_log off;
|
||||
add_header Cache-Control "public";
|
||||
}
|
||||
|
||||
location = /index.html {
|
||||
add_header Cache-Control "no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0";
|
||||
}
|
||||
}
|
12
TaxPayerFull/nginx.conf
Normal file
12
TaxPayerFull/nginx.conf
Normal file
@@ -0,0 +1,12 @@
|
||||
worker_processes 1;
|
||||
|
||||
events { worker_connections 1024; }
|
||||
|
||||
http {
|
||||
include mime.types;
|
||||
default_type application/octet-stream;
|
||||
sendfile on;
|
||||
keepalive_timeout 65;
|
||||
|
||||
|
||||
}
|
10
TaxPayerFull/wwwroot/appsettings.json
Normal file
10
TaxPayerFull/wwwroot/appsettings.json
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"BaseAddress": "http://192.168.1.14:3201/api/",
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
},
|
||||
"AllowedHosts": "*"
|
||||
}
|
48
docker-compose.yml
Normal file
48
docker-compose.yml
Normal file
@@ -0,0 +1,48 @@
|
||||
version: '3.9'
|
||||
|
||||
services:
|
||||
webapi:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: back/Dockerfile
|
||||
image: moadiran.webapi:latest
|
||||
container_name: moadiran-webapi
|
||||
environment:
|
||||
- ASPNETCORE_ENVIRONMENT=Production
|
||||
ports:
|
||||
- "1013:8080"
|
||||
# networks:
|
||||
# - moadirannet
|
||||
|
||||
land:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: moadiran/Dockerfile
|
||||
image: moadiran.land:latest
|
||||
container_name: moadiran-land
|
||||
environment:
|
||||
- ASPNETCORE_ENVIRONMENT=Production
|
||||
ports:
|
||||
- "81:7050"
|
||||
depends_on:
|
||||
- webapi
|
||||
# networks:
|
||||
# - moadirannet
|
||||
|
||||
webapp:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: TaxPayerFull/Dockerfile
|
||||
image: moadiran.webapp:latest
|
||||
container_name: moadiran-webapp
|
||||
ports:
|
||||
- "82:5107"
|
||||
depends_on:
|
||||
- webapi
|
||||
# networks:
|
||||
# - moadirannet
|
||||
|
||||
|
||||
|
||||
|
||||
|
5
moadiran/.config/dotnet-tools.json
Normal file
5
moadiran/.config/dotnet-tools.json
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"version": 1,
|
||||
"isRoot": true,
|
||||
"tools": {}
|
||||
}
|
11
moadiran/DockerCommand.txt
Normal file
11
moadiran/DockerCommand.txt
Normal file
@@ -0,0 +1,11 @@
|
||||
from run E:\TaxPayerFULL
|
||||
docker build -f moadiran\Dockerfile -t land_moadiran .
|
||||
|
||||
docker run --name land_moadiran -d -p 81:8080 land_moadiran
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------------------
|
||||
in local => docker build -f moadiran\Dockerfile -t mmrbnjd/land_moadiran:latest .
|
||||
in local => docker push mmrbnjd/land_moadiran:latest
|
||||
in server => docker pull mmrbnjd/land_moadiran:latest
|
||||
in server => docker run -d -p 3101:8080 --restart always mmrbnjd/land_moadiran:latest
|
30
moadiran/Dockerfile
Normal file
30
moadiran/Dockerfile
Normal file
@@ -0,0 +1,30 @@
|
||||
# See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging.
|
||||
|
||||
# This stage is used when running from VS in fast mode (Default for Debug configuration)
|
||||
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
|
||||
USER $APP_UID
|
||||
WORKDIR /app
|
||||
EXPOSE 8080
|
||||
|
||||
|
||||
# This stage is used to build the service project
|
||||
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
|
||||
ARG BUILD_CONFIGURATION=Release
|
||||
WORKDIR /src
|
||||
COPY ["moadiran/moadiran.csproj", "moadiran/"]
|
||||
COPY ["Shared/Shared.csproj", "Shared/"]
|
||||
RUN dotnet restore "./moadiran/moadiran.csproj"
|
||||
COPY . .
|
||||
WORKDIR "/src/moadiran"
|
||||
RUN dotnet build "./moadiran.csproj" -c $BUILD_CONFIGURATION -o /app/build
|
||||
|
||||
# This stage is used to publish the service project to be copied to the final stage
|
||||
FROM build AS publish
|
||||
ARG BUILD_CONFIGURATION=Release
|
||||
RUN dotnet publish "./moadiran.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
|
||||
|
||||
# This stage is used in production or when running from VS in regular mode (Default when not using the Debug configuration)
|
||||
FROM base AS final
|
||||
WORKDIR /app
|
||||
COPY --from=publish /app/publish .
|
||||
ENTRYPOINT ["dotnet", "moadiran.dll"]
|
@@ -34,13 +34,15 @@ builder.Services.AddScoped(sp => new UserAuthenticationDTO()
|
||||
exitDate = new DateTime(),
|
||||
});
|
||||
|
||||
string BaseAddress = builder.Configuration.GetSection("BaseAddress").Value;
|
||||
builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(BaseAddress) });
|
||||
|
||||
// Server
|
||||
//builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri("http://195.88.208.142:7075/api/") });
|
||||
// builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri("https://moadiran.ir:444/api/") });
|
||||
//builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri("https://moadiran.ir:444/api/") });
|
||||
|
||||
//Home
|
||||
builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri("http://localhost:5271/api/") });
|
||||
//builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri("http://localhost:5271/api/") });
|
||||
|
||||
//farzan
|
||||
//builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri("http://localhost:5271/api/") });
|
||||
|
@@ -1,21 +1,13 @@
|
||||
{
|
||||
"iisSettings": {
|
||||
"windowsAuthentication": false,
|
||||
"anonymousAuthentication": true,
|
||||
"iisExpress": {
|
||||
"applicationUrl": "http://localhost:60550",
|
||||
"sslPort": 44360
|
||||
}
|
||||
},
|
||||
"profiles": {
|
||||
"moadiran": {
|
||||
"commandName": "Project",
|
||||
"dotnetRunMessages": true,
|
||||
"launchBrowser": true,
|
||||
"applicationUrl": "https://localhost:7050;http://localhost:5219",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"dotnetRunMessages": true,
|
||||
"applicationUrl": "https://localhost:7050;http://localhost:5219"
|
||||
},
|
||||
"IIS Express": {
|
||||
"commandName": "IISExpress",
|
||||
@@ -23,6 +15,25 @@
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"Container (Dockerfile)": {
|
||||
"commandName": "Docker",
|
||||
"launchBrowser": true,
|
||||
"launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_HTTPS_PORTS": "8081",
|
||||
"ASPNETCORE_HTTP_PORTS": "8080"
|
||||
},
|
||||
"publishAllPorts": true,
|
||||
"useSSL": true
|
||||
}
|
||||
},
|
||||
"iisSettings": {
|
||||
"windowsAuthentication": false,
|
||||
"anonymousAuthentication": true,
|
||||
"iisExpress": {
|
||||
"applicationUrl": "http://localhost:60550",
|
||||
"sslPort": 44360
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,4 +1,5 @@
|
||||
{
|
||||
"BaseAddress": "http://192.168.1.14:3201/api/",
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
|
@@ -4,6 +4,8 @@
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<UserSecretsId>a89579cc-1c94-4d4e-93a1-86ce286e98ac</UserSecretsId>
|
||||
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
@@ -12,6 +14,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Blazor.Bootstrap" Version="2.2.0" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.21.0" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Shared\Shared.csproj" />
|
||||
|
Reference in New Issue
Block a user