Javítás

This commit is contained in:
2025-04-08 17:46:22 +02:00
parent ac48e676df
commit a394c643a2
6 changed files with 39 additions and 17 deletions
@@ -365,8 +365,8 @@ namespace WorkFlowCheck.API.Controllers
return retVal;
}
[HttpPost("UpdateCheckListHeader")]
public async Task<ApiResponseDTO<string>> UpdateCheckListHeader([FromBody] CheckListHeaderDTO checkListHeaderDTO)
[HttpPost("SendCheckListHeader")]
public async Task<ApiResponseDTO<string>> SendCheckListHeader([FromBody] CheckListHeaderDTO checkListHeaderDTO)
{
var retVal = new ApiResponseDTO<string>()
{
@@ -375,7 +375,7 @@ namespace WorkFlowCheck.API.Controllers
try
{
var result = await _syncService.UpdateCheckListHeaderAsync(checkListHeaderDTO);
var result = await _syncService.SendCheckListHeaderAsync(checkListHeaderDTO);
retVal.Data = "Sikeres beküldés!";
}
@@ -27,7 +27,7 @@ namespace WorkFlowCheck.BL.Services.Interfaces
Task<List<CheckListTemplateHeaderDTO>> GetAllCheckListTemplateAsync(int userId);
Task<List<CheckListHeaderDTO>> GetAllCheckListAsync(int userId);
Task<CheckListHeaderDTO> UpdateCheckListHeaderAsync(CheckListHeaderDTO checkListHeaderDTO);
Task<CheckListHeaderDTO> SendCheckListHeaderAsync(CheckListHeaderDTO checkListHeaderDTO);
Task<bool> DeviceMessageSend(DeviceMessageDTO deviceMessageDTO);
Task<List<DeviceMessageDTO>> DeviceMessageReadUnreaded(string deviceId);
+23 -10
View File
@@ -54,8 +54,8 @@ namespace WorkFlowCheck.BL.Services
{
retVal = _mapper.Map<CheckPointDTO>(checkpoint);
var role = await _dbContext.Roles.Where(w => w.Id == retVal.RoleId).FirstOrDefaultAsync();
var role = await _dbContext.Roles.Where(w => w.Id == retVal.RoleId).FirstOrDefaultAsync();
}
}
catch (Exception ex)
@@ -355,24 +355,34 @@ namespace WorkFlowCheck.BL.Services
return retVal;
}
public async Task<CheckListHeaderDTO> UpdateCheckListHeaderAsync(CheckListHeaderDTO checkListHeaderDTO)
public async Task<CheckListHeaderDTO> SendCheckListHeaderAsync(CheckListHeaderDTO checkListHeaderDTO)
{
var retVal = new CheckListHeaderDTO();
try
{
if (checkListHeaderDTO.Id == 0) //Hozzáadás, ha Id == 0
{
}
else
if (checkListHeaderDTO.Id > 0) //Hozzáadás, ha Id == 0
{
var res = await _dbContext.CheckListHeaders
.Include(i => i.CheckListRows)
.Where(w => w.Id == checkListHeaderDTO.Id)
.FirstOrDefaultAsync();
if (res != null)
if (res != null && (res.CheckStatus == CheckStatus.Open ||
res.CheckStatus == CheckStatus.InProgress))
{
if(CanBlock(checkListHeaderDTO))
{
/// TODO: blokkolás miatt
res.CheckStatus = CheckStatus.Blocked;
await _dbContext.SaveChangesAsync();
Log.Warning("");
return retVal;
}
res.CheckStatus = CheckStatus.InProgress;
var ids = checkListHeaderDTO.CheckListRowDTO?.Select(r => r.Id).ToList();
if (ids != null && ids.Count > 0)
{
@@ -410,7 +420,10 @@ namespace WorkFlowCheck.BL.Services
return retVal;
}
private bool CanBlock(CheckListHeaderDTO checkListHeaderDTO)
{
return false;
}
public async Task<bool> DeviceMessageSend(DeviceMessageDTO deviceMessageDTO)
{
@@ -1,5 +1,7 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@@ -13,9 +15,14 @@ namespace WorkFlowCheck.Common.DTO
public int CheckListTemplateRowId { get; set; }
public CheckListTemplateRowDTO? CheckListTemplateRowDTO { get; set; }
public string GroupName => $"AnswerGroup_{CheckListTemplateRowDTO?.RowIndex ?? 0}";
[DisplayName("Eredmény")]
public string Answer { get; set; } = null!;
public bool? AnswerYes { get; set; } = null!;
public bool? AnswerNo { get; set; } = null!;
[DisplayName("Kép")]
public byte[]? Photo { get; set; } = null!;
public Guid GuidNumber { get; set; }
}
@@ -2,6 +2,8 @@
@model WorkFlowCheck.Web.Pages.CheckList.CheckListHeader.CheckListHeaderEditPageModel
@using Microsoft.AspNetCore.Antiforgery
@inject IAntiforgery Antiforgery
@using WorkFlowCheck.Common.Helper
@using WorkFlowCheck.Common.DTO
@{
ViewData["Title"] = "Ellenőrzés";
var CheckListHeaderId = Model.CheckListHeaderDTO.Id;
@@ -59,8 +61,8 @@
<thead class="table-primary">
<tr>
<th>ID</th>
<th>Short Name</th>
<th>Checkpoint</th>
<th>@DisplayNameHelper.GetDisplayName(nameof(CheckListRowDTO.CheckListTemplateRowDTO.RowIndex), typeof(CheckListTemplateRowDTO))</th>
<th>@DisplayNameHelper.GetDisplayName(nameof(CheckListRowDTO.CheckListTemplateRowDTO.CheckPointDTO.ShortName), typeof(CheckPointDTO))</th>
<th>OperationDescription</th>
<th>AnswerType</th>
<th>Answer</th>
+1 -1
View File
@@ -221,7 +221,7 @@ function renderAnswerType(data) {
return data;
}
function renderAnswerPhoto(data, row) {
if (row.checkListTemplateRowDTO.answerType === 'P') {
if (row.checkListTemplateRowDTO.answerType === 'P' && data.length > 0) {
return `<div class="text-center"><img src="${data}" alt="Image" style="height: 100px; width: auto;" /></div>`;
}
if (row.checkListTemplateRowDTO.answerType === 'SI-N' && data === 'Igen') {