feat: add unit filtering and improve unit info handling in charge cycles

- Add optional UnitId parameter to CostCyclsList method for filtering cycles by specific unit
- Replace UnitIds/UnitNames lists with structured UnitInfoDto containing Id and Name
- Clean unit names by removing "GUID#" prefix when present
- Update CostCycleDto to use UnitInfoDto list instead of separate Id and Name lists
- Fix unit assignment logic in Add and Edit methods to use new DTO structure
This commit is contained in:
2026-06-10 20:17:46 +03:30
parent 3bc209839e
commit e4fe2389a4
3 changed files with 38 additions and 16 deletions

View File

@@ -41,11 +41,12 @@ namespace Complex.EndPoint.Controllers
/// <param name="EndDate"></param>
/// <returns></returns>
[HttpPost]
public ResultDto<List<CostCycleDto>> CostCyclsList([FromForm] Guid ComplexId, [FromForm] DateTime? StartDate = null, [FromForm] DateTime? EndDate = null)
public ResultDto<List<CostCycleDto>> CostCyclsList([FromForm] Guid ComplexId, [FromForm] DateTime? StartDate = null, [FromForm] DateTime? EndDate = null, [FromForm] Guid? UnitId = null)
{
return _costCycleService.CostCyclsList(ComplexId,
!StartDate.HasValue ? null : DateOnly.FromDateTime(StartDate.Value),
!EndDate.HasValue ? null : DateOnly.FromDateTime(EndDate.Value));
!EndDate.HasValue ? null : DateOnly.FromDateTime(EndDate.Value),
UnitId: UnitId);
}
/// <summary>
/// بدهی یک واحد