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