2025-01-11 12:42:36 +03:30
|
|
|
|
using Back.Common;
|
|
|
|
|
using Back.Data.Contracts;
|
2025-01-11 10:10:47 +03:30
|
|
|
|
using Back.Data.Models.Warehouse;
|
|
|
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
|
using Microsoft.OpenApi.Extensions;
|
2025-01-11 12:42:36 +03:30
|
|
|
|
using Shared.DTOs;
|
2025-01-11 10:10:47 +03:30
|
|
|
|
using Shared.DTOs.Warehouse;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
namespace Back.Services.Warehouse
|
|
|
|
|
{
|
|
|
|
|
public class WarehouseService
|
|
|
|
|
{
|
|
|
|
|
private readonly IAsyncRepository<Remittance> _RemittanceRepo;
|
|
|
|
|
private readonly IAsyncRepository<Receipt> _ReceiptRepo;
|
|
|
|
|
|
|
|
|
|
public WarehouseService(IAsyncRepository<Remittance> remittanceRepo, IAsyncRepository<Receipt> receiptRepo)
|
|
|
|
|
{
|
|
|
|
|
_RemittanceRepo = remittanceRepo;
|
|
|
|
|
_ReceiptRepo = receiptRepo;
|
|
|
|
|
}
|
2025-01-11 12:42:36 +03:30
|
|
|
|
public async Task<PagingDto<CirculationDto>> Circulation(int CompanyID,string date="",int CODID=0,int PageIndex=1,int PageSize=5)
|
2025-01-11 10:10:47 +03:30
|
|
|
|
{
|
|
|
|
|
var RequestRemittance = _RemittanceRepo.Get(w => w.cODItem.CompanyID == CompanyID)
|
|
|
|
|
.Select(s=>new CirculationDto
|
|
|
|
|
{
|
|
|
|
|
CODID=s.CODID,
|
|
|
|
|
CODTitle=s.cODItem.Title,
|
|
|
|
|
Date=s.Date,
|
|
|
|
|
Count=s.Count,
|
|
|
|
|
info=s.info,
|
|
|
|
|
Type=TypeCirculation.Remittance,
|
|
|
|
|
ModelTypeID = (int)s.Type,
|
|
|
|
|
ModelTypeTitle= s.Type.GetDisplayName()
|
|
|
|
|
});
|
|
|
|
|
if (!string.IsNullOrEmpty(date))
|
|
|
|
|
RequestRemittance = RequestRemittance.Where(w => w.Date == date);
|
|
|
|
|
if (CODID!=0)
|
|
|
|
|
RequestRemittance = RequestRemittance.Where(w => w.CODID == CODID);
|
|
|
|
|
//-----------
|
|
|
|
|
var RequestReceipt = _ReceiptRepo.Get(w => w.cODItem.CompanyID == CompanyID)
|
|
|
|
|
.Select(s => new CirculationDto
|
|
|
|
|
{
|
|
|
|
|
CODID = s.CODID,
|
|
|
|
|
CODTitle = s.cODItem.Title,
|
|
|
|
|
Date = s.Date,
|
|
|
|
|
Count = s.Count,
|
|
|
|
|
info = s.info,
|
|
|
|
|
Type = TypeCirculation.Receipt,
|
|
|
|
|
ModelTypeID = (int)s.Type,
|
|
|
|
|
ModelTypeTitle = s.Type.GetDisplayName()
|
|
|
|
|
});
|
|
|
|
|
if (!string.IsNullOrEmpty(date))
|
|
|
|
|
RequestReceipt = RequestReceipt.Where(w => w.Date == date);
|
|
|
|
|
if (CODID != 0)
|
|
|
|
|
RequestReceipt = RequestReceipt.Where(w => w.CODID == CODID);
|
|
|
|
|
|
2025-01-11 12:42:36 +03:30
|
|
|
|
return await RequestReceipt.Union(RequestRemittance).OrderByDescending(o => o.Date).Paging(PageIndex, PageSize);
|
|
|
|
|
//var list = await RequestReceipt.ToListAsync();
|
|
|
|
|
//list.AddRange(await RequestRemittance.ToListAsync());
|
|
|
|
|
//return await list.OrderByDescending(o=>o.Date).AsQueryable().Paging(PageIndex, PageSize);
|
|
|
|
|
}
|
|
|
|
|
public async Task Inventory(int CompanyID,int CODID)
|
|
|
|
|
{
|
|
|
|
|
|
2025-01-11 10:10:47 +03:30
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|