This commit is contained in:
mmrbnjd
2024-06-26 17:10:29 +03:30
parent df6d5905ac
commit 478456c03f
11 changed files with 247 additions and 7 deletions

View File

@@ -36,7 +36,7 @@
<ItemGroup>
<Reference Include="Service">
<HintPath>..\..\Dlls\Service.dll</HintPath>
<HintPath>..\..\..\LocalGit\TaxPayerTools\Service\bin\Debug\Service.dll</HintPath>
</Reference>
</ItemGroup>

View File

@@ -0,0 +1,71 @@
using Back.Data.Models;
using Back.Services;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
using Shared.DTOs;
namespace Back.Controllers
{
[Route("api/[controller]")]
[Authorize]
[ApiController]
public class stuffController : ControllerBase
{
private readonly Servstuff _Servstuff;
public stuffController(Servstuff Servstuff)
{
_Servstuff = Servstuff;
}
[HttpGet("Getstuff/{value}")]
public async Task<ActionResult> Getstuff(string value)
{
return Ok(await _Servstuff.Getstuff(value));
}
//[HttpPost("InitalInTb")]
//public async Task<ActionResult> InitalInTb()
//{
// int countererror = 0;
// List<stuff> stuffDtos = new List<stuff>();
// //------
// using (StreamReader sr = new StreamReader("C://AllserviceStuff.CSV"))
// {
// string line = "";
// while ((line = sr.ReadLine()) != null)
// {
// string[] cells = line.Split(new char[] { '\r', '\n' }, StringSplitOptions.None);
// if (cells.Length > 0)
// {
// var item = cells[0].Split(',');
// if (item[0] == "ID") continue;
// try
// {
// stuffDtos.Add(new stuff
// {
// CID = item[0],
// sType = item[1],
// sDate = item[2],
// RunDate = item[3],
// ExpirationDate = item[4],
// SpecialOrGeneral = item[5],
// TaxableOrFree = item[6],
// Vat = item[7],
// VatCustomPurposes = item[8],
// DescriptionOfID = item[9]
// });
// }
// catch (Exception)
// {
// countererror++;
// }
// }
// }
// }
// return Ok(await _Servstuff.AddRange(stuffDtos));
//}
}
}

View File

@@ -44,6 +44,7 @@ namespace TaxPayer.Infrastructure.Persistence
public DbSet<TiceketUnknownPeople> TiceketUnknownPeoples { get; set; }
public DbSet<SaleLead> SaleLeads { get; set; }
public DbSet<UserNotfi> UserNotifis { get; set; }
public DbSet<stuff> Stuffs { get; set; }
#endregion
//public override Task<int> SaveChangesAsync(CancellationToken cancellationToken = new CancellationToken())
//{

25
Back/Data/Models/stuff.cs Normal file
View File

@@ -0,0 +1,25 @@
namespace Back.Data.Models
{
public class stuff
{
public int ID { get; set; }
//شناسه کالا/خدمت
public string? CID { get; set; }
// نوع شناسه کالا/خدمت
public string? sType { get; set; }
//تاریخ ثبت
public string? sDate { get; set; }
public string? RunDate { get; set; }
public string? ExpirationDate { get; set; }
//عمومی یا خاص بودن شناسه
public string? SpecialOrGeneral { get; set; }
//مشمول یا معاف بودن
public string? TaxableOrFree { get; set; }
//نرخ ارزش افزوده
public string? Vat { get; set; }
// نرخ ارزش افزوده مبادی گمرکی
public string? VatCustomPurposes { get; set; }
//شرح شناسه کالا/خدمت
public string? DescriptionOfID { get; set; }
}
}

View File

@@ -76,6 +76,7 @@ builder.Services.AddScoped<AddOrUpdateInvoiceValidation>();
builder.Services.AddScoped<AUInvoiceItemValidation>();
builder.Services.AddScoped<servInvoiceItem>();
builder.Services.AddScoped<ActionTaxPayer>();
builder.Services.AddScoped<Servstuff>();
builder.Services.AddScoped(c => new mpNuget.RestClient("09119660045", "C54S2"));
string origins = "OriginTaxPayer";

View File

@@ -0,0 +1,31 @@
using Back.Data.Contracts;
using Back.Data.Models;
using Microsoft.EntityFrameworkCore;
using Shared.DTOs;
namespace Back.Services
{
public class Servstuff
{
private readonly IAsyncRepository<stuff> _repostuff;
public Servstuff(IAsyncRepository<stuff> repostuff)
{
_repostuff=repostuff;
}
public async Task<List<stuffDto>> Getstuff(string value)
{
var request = _repostuff.Get(w => w.sType.Contains(value) || w.DescriptionOfID.Contains(value) || w.CID.Contains(value));
return await request.Select(s=>new stuffDto
{
DescriptionOfID=s.DescriptionOfID,
ID=string.IsNullOrEmpty(s.CID) ? 0 :Convert.ToUInt64(s.CID),
TaxableOrFree=s.TaxableOrFree,
Type=s.sType,
Vat= string.IsNullOrEmpty(s.Vat) ? 0 :Convert.ToInt32(s.Vat),
// VatCustomPurposes = string.IsNullOrEmpty(s.VatCustomPurposes) ? 0 : Convert.ToInt32(s.VatCustomPurposes)
}).ToListAsync();
}
}
}

26
Shared/DTOs/stuffDto.cs Normal file
View File

@@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static System.Runtime.InteropServices.JavaScript.JSType;
namespace Shared.DTOs
{
public class stuffDto
{
//شناسه کالا/خدمت
public UInt64? ID { get; set; }
// نوع شناسه کالا/خدمت
public string? Type { get; set; }
//مشمول یا معاف بودن
public string? TaxableOrFree { get; set; }
//نرخ ارزش افزوده
public int? Vat { get; set; }
//// نرخ ارزش افزوده مبادی گمرکی
//public int? VatCustomPurposes { get; set; }
//شرح شناسه کالا/خدمت
public string? DescriptionOfID { get; set; }
}
}

View File

@@ -1,6 +1,7 @@
@using Front.Services
@using Shared.DTOs
@inject HttpClientController hc;
<Modal @ref="modal" />
<form>
@* alert *@
<div class="row">
@@ -80,6 +81,7 @@ else
@code {
private Modal modal = default!;
// alert
AlertColor alertColor = AlertColor.Primary;
IconName alertIconName = IconName.CheckCircleFill;
@@ -196,4 +198,6 @@ else
}
else ShowDangerAlert("فیلدهای قرمز باید مقدار دهی شوند");
}
}

View File

@@ -0,0 +1,66 @@
@using Shared.DTOs;
@using Front.Services
@inject HttpClientController hc;
<div class="mb-3 row">
<div class="col-md-10">
<InputText @bind-Value="@Value" onclick="" style="text-align:center;" class="form-control" placeholder="دنبال چی ؟" id="html5-password-input3" />
</div> <div class="col-md-2">
<button onclick="" type="submit" class="btn btn-primary">ارسال</button>
</div>
</div>
<div class="row">
<div class="col-md-12">
<Grid TItem="stuffDto" class="table table-hover table-bordered table-striped" DataProvider="DataProvider" AllowFiltering="true" Responsive="true" AllowPaging="true" PageSize="5">
<GridColumn TItem="stuffDto" HeaderText="شناسه" PropertyName="Id">
@context.ID
</GridColumn>
<GridColumn TItem="stuffDto" HeaderText="نوع شناسه کالا" PropertyName="Type" StringComparison="StringComparison.Ordinal">
@context.Type
</GridColumn>
<GridColumn TItem="stuffDto" HeaderText="مشمول یا معاف" PropertyName="TaxableOrFree">
@context.TaxableOrFree
</GridColumn>
<GridColumn TItem="stuffDto" HeaderText="نرخ ارزش افزوده" PropertyName="Vat">
@context.Vat
</GridColumn>
@* <GridColumn TItem="stuffDto" HeaderText="نرخ ارزش افزوده مبادی گمرکی" PropertyName="VatCustomPurposes">
@context.VatCustomPurposes
</GridColumn> *@
<GridColumn TItem="stuffDto" HeaderText="شرح شناسه کالا" PropertyName="DescriptionOfID">
@context.DescriptionOfID
</GridColumn>
</Grid>
</div>
</div>
@code {
private IEnumerable<stuffDto> stuffDtos;
public string Value { get; set; }
protected override void OnInitialized()
{
stuffDtos = new List<stuffDto>();
}
}
@functions {
public async Task Search()
{
if (!string.IsNullOrEmpty(Value))
{
var rsp = await hc.Get($"stuff/Getstuff/{Value}");
if (rsp.IsSuccessStatusCode)
{
stuffDtos = await rsp.Content.ReadFromJsonAsync<List<stuffDto>>();
}
}
}
private async Task<GridDataProviderResult<stuffDto>> DataProvider(GridDataProviderRequest<stuffDto> request)
{
return await Task.FromResult(request.ApplyTo(stuffDtos));
}
}

View File

@@ -7,7 +7,6 @@
@inject Fixedvalues fv;
<PageTitle>کالا</PageTitle>
<Modal @ref="modal" />
<Preload LoadingText="در حال بارگذاری..." />
@* search *@
<div class="row">
@@ -60,10 +59,18 @@
<div class="col-md-12">
<div class="mb-2">
<div class="row">
<div class="col-md-12">
<div class="col-md-10">
<div class="col-auto">
<button type="submit" @onclick="()=>CodItem(0)" class="btn btn-primary">جدید</button>
</div>
</div>
<div class="col-md-2">
<div class="col-auto">
<Button Color="ButtonColor.Info" @onclick="Showstuff" Type="ButtonType.Button">
دریافت شناسه کالا
</Button>
</div>
</div>
</div>
</div>
@@ -110,7 +117,7 @@
@layout PanelLayout
@code {
//private Modal stuffmodal = default!;
[Inject] protected PreloadService PreloadService { get; set; } = default!;
ItemSerchGetCOD itemsearch = new ItemSerchGetCOD();
[Parameter, SupplyParameterFromQuery]
@@ -201,7 +208,6 @@
}
public async Task CodItem(int ID)
{
var parameters = new Dictionary<string, object>();
if(ID == 0) parameters.Add("Cod", new RCOD(){ID=0});
@@ -211,5 +217,14 @@
await modal.ShowAsync<CodItem>(title: ID == 0 ? "کالا جدید" : "ویرایش اطلاعات", parameters: parameters);
}
public async Task Showstuff()
{
var parameters = new Dictionary<string, object>();
modal.Size = ModalSize.ExtraLarge;
await modal.ShowAsync<Front.CUSComponent.Taxstuff>(title: "دریافت شناسه کالا", parameters: parameters);
}
}

View File

@@ -34,9 +34,9 @@ builder.Services.AddScoped(sp => new UserAuthenticationDTO()
}) ;
builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri("https://localhost:7075/api/") });
//builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri("https://localhost:7075/api/") });
//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/") });
CultureInfo.DefaultThreadCurrentCulture = new CultureInfo("fa-Ir");