...
This commit is contained in:
@@ -95,6 +95,21 @@ namespace Back.Common
|
||||
return new PagingDto<T>(rowCount, PageCount, await values.Skip(skip).Take(take).ToListAsync());
|
||||
}
|
||||
|
||||
}
|
||||
public static async Task<PagingDto<T>> Paging<T>(this IEnumerable<T> values, int pageId, int take)
|
||||
{
|
||||
if (/*values.Count()<1000 && */pageId == 0 && take == 0)
|
||||
{
|
||||
return new PagingDto<T>(values.Count(), 1, values.ToList());
|
||||
}
|
||||
else
|
||||
{
|
||||
int skip = (pageId - 1) * take;
|
||||
int rowCount = values.Count();
|
||||
int PageCount = rowCount % take == 0 ? rowCount / take : rowCount / take + 1;
|
||||
return new PagingDto<T>(rowCount, PageCount, values.Skip(skip).Take(take).ToList());
|
||||
}
|
||||
|
||||
}
|
||||
public static System.Linq.Expressions.Expression<Func<TEntity, bool>> GetFunc<TEntity>(string Fild, string Value)
|
||||
{
|
||||
|
@@ -27,7 +27,7 @@ namespace Back.Services.Warehouse
|
||||
{
|
||||
var model = new Receipt()
|
||||
{
|
||||
Date = item.Date,
|
||||
Date = item.Date.Replace("/",""),
|
||||
CODID = item.CODID,
|
||||
Count = item.Count,
|
||||
ForSale = item.ForSale,
|
||||
@@ -60,7 +60,7 @@ namespace Back.Services.Warehouse
|
||||
public async Task<ReceiptDto?> Update(ReceiptDto item)
|
||||
{
|
||||
var model= await _ReceiptRepo.Get(w => w.ID == item.ID).FirstOrDefaultAsync();
|
||||
model.Date= item.Date;
|
||||
model.Date= item.Date.Replace("/", "");
|
||||
model.CODID= item.CODID;
|
||||
model.Count= item.Count;
|
||||
model.ForSale= item.ForSale;
|
||||
|
@@ -19,7 +19,7 @@ namespace Back.Services.Warehouse
|
||||
{
|
||||
var model = new Remittance()
|
||||
{
|
||||
Date = item.Date,
|
||||
Date = item.Date.Replace("/", ""),
|
||||
CODID = item.CODID,
|
||||
Count = item.Count,
|
||||
info = item.info,
|
||||
@@ -44,7 +44,7 @@ namespace Back.Services.Warehouse
|
||||
public async Task<RemittanceDto?> Update(RemittanceDto item)
|
||||
{
|
||||
var model = await _ReceiptRepo.Get(w => w.ID == item.ID).FirstOrDefaultAsync();
|
||||
model.Date = item.Date;
|
||||
model.Date = item.Date.Replace("/", "");
|
||||
model.CODID = item.CODID;
|
||||
model.Count = item.Count;
|
||||
model.info = item.info;
|
||||
|
@@ -1,4 +1,5 @@
|
||||
using Back.Common;
|
||||
|
||||
using Back.Common;
|
||||
using Back.Data.Contracts;
|
||||
using Back.Data.Models.Warehouse;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
@@ -36,7 +37,7 @@ namespace Back.Services.Warehouse
|
||||
info = s.info,
|
||||
Type = TypeCirculation.Remittance,
|
||||
ModelTypeID = (int)s.Type,
|
||||
ModelTypeTitle = s.Type.GetDisplayName(),
|
||||
ModelTypeTitle = s.Type.GetEnumDisplayName(),
|
||||
invoiceID = s.InvoiceID,
|
||||
});
|
||||
if (!string.IsNullOrEmpty(date))
|
||||
@@ -55,24 +56,23 @@ namespace Back.Services.Warehouse
|
||||
info = s.info,
|
||||
Type = TypeCirculation.Receipt,
|
||||
ModelTypeID = (int)s.Type,
|
||||
ModelTypeTitle = s.Type.GetDisplayName(),
|
||||
ModelTypeTitle = s.Type.GetEnumDisplayName(),
|
||||
invoiceID = s.InvoiceID,
|
||||
ForSale = s.ForSale,
|
||||
});
|
||||
if (!string.IsNullOrEmpty(date))
|
||||
RequestReceipt = RequestReceipt.Where(w => w.Date == date);
|
||||
if (CODID != 0)
|
||||
RequestReceipt = RequestReceipt.Where(w => w.CODID == CODID);
|
||||
try
|
||||
{
|
||||
var item = await RequestReceipt.Union(RequestRemittance).OrderByDescending(o => o.Date).ToListAsync();
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
var itemsReceipt = await RequestReceipt.ToListAsync();
|
||||
var Remittance = await RequestRemittance.ToListAsync();
|
||||
|
||||
throw;
|
||||
}
|
||||
return await RequestReceipt.Union(RequestRemittance).OrderByDescending(o => o.Date).Paging(PageIndex, PageSize);
|
||||
|
||||
return await itemsReceipt.Union(Remittance).OrderByDescending(o => o.Date).Paging(PageIndex, PageSize);
|
||||
|
||||
|
||||
// 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);
|
||||
|
@@ -16,7 +16,7 @@ namespace Back.Validations.Warehouse.Receipt
|
||||
|
||||
RuleFor(model => model)
|
||||
.Custom((model, context) => {
|
||||
if (servCOD.ExistCodByCompanyID(model.Item1.CODID, model.Item2).Result)
|
||||
if (!servCOD.ExistCodByCompanyID(model.Item1.CODID, model.Item2).Result)
|
||||
context.AddFailure("کد کالا یافت نشد");
|
||||
});
|
||||
|
||||
|
@@ -26,17 +26,11 @@ namespace Back.Validations.Warehouse.Receipt
|
||||
context.AddFailure("رسید یافت نشد");
|
||||
else
|
||||
{
|
||||
if (ORGitem.CODID != model.Item1.CODID)
|
||||
{
|
||||
if (servCOD.ExistCodByCompanyID(model.Item1.CODID, model.Item2).Result)
|
||||
context.AddFailure("کد کالا یافت نشد");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if (ORGitem.CODID != model.Item1.CODID)
|
||||
{
|
||||
|
||||
context.AddFailure("در رسید امکان ویرایش کالا انکان پذیر نیست");
|
||||
context.AddFailure("در رسید امکان ویرایش کالا امکان پذیر نیست");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -69,7 +63,7 @@ namespace Back.Validations.Warehouse.Receipt
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
|
@@ -14,7 +14,7 @@ namespace Back.Validations.Warehouse.Remittance
|
||||
RuleFor(model => model)
|
||||
.Custom((model, context) =>
|
||||
{
|
||||
if (servCOD.ExistCodByCompanyID(model.Item1.CODID, model.Item2).Result)
|
||||
if (!servCOD.ExistCodByCompanyID(model.Item1.CODID, model.Item2).Result)
|
||||
context.AddFailure("کد کالا یافت نشد");
|
||||
});
|
||||
|
||||
|
@@ -27,7 +27,7 @@ namespace Back.Validations.Warehouse.Remittance
|
||||
if (ORGitem.CODID != model.Item1.CODID)
|
||||
{
|
||||
|
||||
context.AddFailure("در حئاله امکان ویرایش کالا انکان پذیر نیست");
|
||||
context.AddFailure("در حواله امکان ویرایش کالا امکان پذیر نیست");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Reference in New Issue
Block a user