This commit is contained in:
mmrbnjd
2025-01-19 17:44:20 +03:30
parent be0616ac97
commit d14c474c6b
20 changed files with 570 additions and 74 deletions

View File

@@ -24,6 +24,7 @@ namespace Back.Services.Warehouse
Count = item.Count,
info = item.info,
Type = item.Type,
Deleted=false
};
var returnmodel = await _ReceiptRepo.AddAsync(model);
if (returnmodel != null)
@@ -36,6 +37,10 @@ namespace Back.Services.Warehouse
return null;
}
}
public async Task AddRange(List<Remittance> items)
{
await _ReceiptRepo.AddRangeAsync(items);
}
public async Task<RemittanceDto?> Update(RemittanceDto item)
{
var model = await _ReceiptRepo.Get(w => w.ID == item.ID).FirstOrDefaultAsync();
@@ -44,6 +49,7 @@ namespace Back.Services.Warehouse
model.Count = item.Count;
model.info = item.info;
model.Type = item.Type;
var returnmodel = await _ReceiptRepo.UpdateAsync(model);
if (returnmodel)
{
@@ -56,14 +62,14 @@ namespace Back.Services.Warehouse
}
public async Task<bool> Delete(int itemID, int CompanyID)
{
var model = await _ReceiptRepo.Get(w => w.ID == itemID && w.cODItem.CompanyID == CompanyID).FirstOrDefaultAsync();
return await _ReceiptRepo.DeleteAsync(model);
var model = await _ReceiptRepo.Get(w => w.ID == itemID && w.cODItem.CompanyID == CompanyID && !w.Deleted).FirstOrDefaultAsync();
model.Deleted = true;
return await _ReceiptRepo.UpdateAsync(model);
}
public async Task<RemittanceDto?> Get(int itemID, int CompanyID)
{
return await _ReceiptRepo.Get(w => w.ID == itemID && w.cODItem.CompanyID == CompanyID)
return await _ReceiptRepo.Get(w => w.ID == itemID && w.cODItem.CompanyID == CompanyID && !w.Deleted)
.Include(inc => inc.cODItem)
.Select(s => new RemittanceDto()
{
@@ -83,7 +89,7 @@ namespace Back.Services.Warehouse
}
public async Task<List<RemittanceDto>?> GetAll(int CompanyID, TypeRemittance? Type = null, int CODID = 0)
{
var request = _ReceiptRepo.Get(w => w.cODItem.CompanyID == CompanyID);
var request = _ReceiptRepo.Get(w => w.cODItem.CompanyID == CompanyID && !w.Deleted);
if (Type != null)
request = request.Where(w => w.Type == Type);
@@ -108,6 +114,20 @@ namespace Back.Services.Warehouse
}
public async Task<bool> HasaRemittance(int InvoiceID)
{
return await _ReceiptRepo.Get(w => w.InvoiceID == InvoiceID && !w.Deleted).AnyAsync();
}
public async Task<bool> HasaRemittance(int InvoiceID,int CODID)
{
return await _ReceiptRepo.Get(w => w.InvoiceID == InvoiceID && w.CODID==CODID && !w.Deleted).AnyAsync();
}
public async Task DeleteByInvoiceIDandCODID(int InvoiceID, int CODID)
{
var model = await _ReceiptRepo.Get(w => w.InvoiceID == InvoiceID && w.CODID == CODID && !w.Deleted).FirstOrDefaultAsync();
model.Deleted = true;
await _ReceiptRepo.UpdateAsync(model);
}
}
}