Most működik egy tesztelhető verzió.
This commit is contained in:
@@ -17,6 +17,8 @@ namespace WorkFlowCheck.MAUI.Helper
|
|||||||
{
|
{
|
||||||
public static string DatabaseName = "";
|
public static string DatabaseName = "";
|
||||||
public static bool Syncronised = false;
|
public static bool Syncronised = false;
|
||||||
|
public static UserDTO SystemUserDTO;
|
||||||
|
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
public static string ApiBaseUrl = $"https://dev.wfcapi.nuvolar.hu/";
|
public static string ApiBaseUrl = $"https://dev.wfcapi.nuvolar.hu/";
|
||||||
public static string ApiKey = $"RUJeLSpSMzVASUdaRCEzUyYxRSE0VyFISFRSJC0zRzhLM1hCSDU=";
|
public static string ApiKey = $"RUJeLSpSMzVASUdaRCEzUyYxRSE0VyFISFRSJC0zRzhLM1hCSDU=";
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ namespace WorkFlowCheck.MAUI
|
|||||||
{
|
{
|
||||||
_currentUser = _userService.GetCurrentUser();
|
_currentUser = _userService.GetCurrentUser();
|
||||||
DeviceId.Text = $"{_userService.DeviceId}";
|
DeviceId.Text = $"{_userService.DeviceId}";
|
||||||
UserInfo.Text = $"{_currentUser?.FirstName} {_currentUser?.LastName}";
|
UserInfo.Text = $"{_currentUser?.LastName} {_currentUser?.FirstName}";
|
||||||
}
|
}
|
||||||
override protected async void OnAppearing()
|
override protected async void OnAppearing()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ public partial class BaseStockPage : ContentPage
|
|||||||
{
|
{
|
||||||
_currentUser = _userService.GetCurrentUser();
|
_currentUser = _userService.GetCurrentUser();
|
||||||
DeviceId.Text = _userService.DeviceId;
|
DeviceId.Text = _userService.DeviceId;
|
||||||
UserInfo.Text = $"{_currentUser?.FirstName} {_currentUser?.LastName}";
|
UserInfo.Text = $"{_currentUser?.LastName} {_currentUser?.FirstName}";
|
||||||
}
|
}
|
||||||
|
|
||||||
override protected async void OnAppearing()
|
override protected async void OnAppearing()
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ using System.Threading.Tasks;
|
|||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
using WorkFlowCheck.Common.DTO;
|
using WorkFlowCheck.Common.DTO;
|
||||||
using WorkFlowCheck.Common.Enums;
|
using WorkFlowCheck.Common.Enums;
|
||||||
|
using WorkFlowCheck.MAUI.Helper;
|
||||||
using WorkFlowCheck.MAUI.Pages.NFC;
|
using WorkFlowCheck.MAUI.Pages.NFC;
|
||||||
using WorkFlowCheck.MAUI.Services.Interfaces;
|
using WorkFlowCheck.MAUI.Services.Interfaces;
|
||||||
|
|
||||||
@@ -131,6 +132,8 @@ public partial class CheckListPage : ContentPage
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
private async void OnContinueItem(CheckListHeaderDTO checkListHeaderDTO)
|
private async void OnContinueItem(CheckListHeaderDTO checkListHeaderDTO)
|
||||||
|
{
|
||||||
|
if (CrossNFC.IsSupported && CrossNFC.Current.IsAvailable)
|
||||||
{
|
{
|
||||||
var checkPointCode = await NFCWaiter.ShowModalAsync();
|
var checkPointCode = await NFCWaiter.ShowModalAsync();
|
||||||
if (!string.IsNullOrEmpty(checkPointCode))
|
if (!string.IsNullOrEmpty(checkPointCode))
|
||||||
@@ -143,6 +146,25 @@ public partial class CheckListPage : ContentPage
|
|||||||
await Navigation.PushAsync(new CheckListWorkPage(checkListHeaderDTO.Id, checkPointCode));
|
await Navigation.PushAsync(new CheckListWorkPage(checkListHeaderDTO.Id, checkPointCode));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Ha nincs NFC, akkor az utoljára beküldött és a sorrendben lévõ checkpointra ugrik
|
||||||
|
var nextCheckPoint = await _checkListService.GetNextCheckpointNotSend(checkListHeaderDTO);
|
||||||
|
if (nextCheckPoint != null && nextCheckPoint.Id > 0)
|
||||||
|
{
|
||||||
|
if (!string.IsNullOrEmpty(nextCheckPoint.Code))
|
||||||
|
{
|
||||||
|
if (Navigation.ModalStack.Count > 0)
|
||||||
|
{
|
||||||
|
await Navigation.PopModalAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
await Navigation.PushAsync(new CheckListWorkPage(checkListHeaderDTO.Id, nextCheckPoint.Code));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
private async void OnUnblockItem(CheckListHeaderDTO checkListHeaderDTO)
|
private async void OnUnblockItem(CheckListHeaderDTO checkListHeaderDTO)
|
||||||
{
|
{
|
||||||
bool answer = await DisplayAlert("Megerõsítés", "Biztosan feloldod a blokkolást?", "Igen", "Mégsem");
|
bool answer = await DisplayAlert("Megerõsítés", "Biztosan feloldod a blokkolást?", "Igen", "Mégsem");
|
||||||
@@ -211,7 +233,16 @@ public class BlockedConverter : IValueConverter
|
|||||||
{
|
{
|
||||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
{
|
{
|
||||||
if (value is CheckStatus status)
|
var canEnableBlocked = false;
|
||||||
|
foreach (var roleDTO in SystemHelper.SystemUserDTO.RoleDTO)
|
||||||
|
{
|
||||||
|
if (roleDTO.CanEnableBlocked)
|
||||||
|
{
|
||||||
|
canEnableBlocked = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (value is CheckStatus status && canEnableBlocked)
|
||||||
{
|
{
|
||||||
return status == CheckStatus.InProgress;
|
return status == CheckStatus.InProgress;
|
||||||
}
|
}
|
||||||
@@ -227,9 +258,18 @@ public class UnBlockedConverter : IValueConverter
|
|||||||
{
|
{
|
||||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
{
|
{
|
||||||
|
var canEnableBlocked = false;
|
||||||
|
foreach (var roleDTO in SystemHelper.SystemUserDTO.RoleDTO)
|
||||||
|
{
|
||||||
|
if (roleDTO.CanEnableBlocked)
|
||||||
|
{
|
||||||
|
canEnableBlocked = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (value is CheckStatus status)
|
if (value is CheckStatus status)
|
||||||
{
|
{
|
||||||
if (status == CheckStatus.Blocked)
|
if (status == CheckStatus.Blocked && canEnableBlocked)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -247,7 +287,7 @@ public class ContinueConverter : IValueConverter
|
|||||||
{
|
{
|
||||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
{
|
{
|
||||||
if (value is CheckStatus status && CrossNFC.IsSupported && CrossNFC.Current.IsAvailable)
|
if (value is CheckStatus status)
|
||||||
{
|
{
|
||||||
if (status == CheckStatus.InProgress || status == CheckStatus.Open)
|
if (status == CheckStatus.InProgress || status == CheckStatus.Open)
|
||||||
{
|
{
|
||||||
@@ -267,7 +307,16 @@ public class AcceptConverter : IValueConverter
|
|||||||
{
|
{
|
||||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
{
|
{
|
||||||
if (value is CheckStatus status)
|
var canEnableBlocked = false;
|
||||||
|
foreach (var roleDTO in SystemHelper.SystemUserDTO.RoleDTO)
|
||||||
|
{
|
||||||
|
if (roleDTO.CanEnableBlocked)
|
||||||
|
{
|
||||||
|
canEnableBlocked = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (value is CheckStatus status && canEnableBlocked)
|
||||||
{
|
{
|
||||||
if (status == CheckStatus.Sent)
|
if (status == CheckStatus.Sent)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
Title="">
|
Title="">
|
||||||
<Shell.TitleView>
|
<Shell.TitleView>
|
||||||
<Grid Padding="2" VerticalOptions="Center">
|
<Grid Padding="2" VerticalOptions="Center">
|
||||||
<Label Text=""
|
<Label x:Name="HeaderLabel" Text=""
|
||||||
FontSize="22"
|
FontSize="22"
|
||||||
FontAttributes="Bold"
|
FontAttributes="Bold"
|
||||||
VerticalOptions="Center"
|
VerticalOptions="Center"
|
||||||
|
|||||||
@@ -12,10 +12,11 @@ public partial class CheckListWorkPage : ContentPage
|
|||||||
{
|
{
|
||||||
private readonly ICheckListService _checkListService;
|
private readonly ICheckListService _checkListService;
|
||||||
private readonly ISyncService _syncService;
|
private readonly ISyncService _syncService;
|
||||||
|
private readonly IUserService _userService;
|
||||||
|
|
||||||
private string _checkPointCode;
|
private string _checkPointCode;
|
||||||
private int _checkListHeaderId;
|
private int _checkListHeaderId;
|
||||||
private UserDTO _userDTO;
|
private UserDTO _currentUser;
|
||||||
private bool _isLoading;
|
private bool _isLoading;
|
||||||
|
|
||||||
|
|
||||||
@@ -40,12 +41,25 @@ public partial class CheckListWorkPage : ContentPage
|
|||||||
_checkListHeaderId = checkListHeaderId;
|
_checkListHeaderId = checkListHeaderId;
|
||||||
_checkListService = MauiProgram.ServiceProvider.GetRequiredService<ICheckListService>();
|
_checkListService = MauiProgram.ServiceProvider.GetRequiredService<ICheckListService>();
|
||||||
_syncService = MauiProgram.ServiceProvider.GetRequiredService<ISyncService>();
|
_syncService = MauiProgram.ServiceProvider.GetRequiredService<ISyncService>();
|
||||||
_userDTO = MauiProgram.ServiceProvider.GetRequiredService<IUserService>().GetCurrentUser();
|
_userService = MauiProgram.ServiceProvider.GetRequiredService<IUserService>();
|
||||||
|
|
||||||
SaveCommand = new Command(OnSave);
|
SaveCommand = new Command(OnSave);
|
||||||
SendCommand = new Command(OnSend);
|
SendCommand = new Command(OnSend);
|
||||||
}
|
}
|
||||||
|
private async Task SetInfo()
|
||||||
|
{
|
||||||
|
_currentUser = _userService.GetCurrentUser();
|
||||||
|
DeviceId.Text = _userService.DeviceId;
|
||||||
|
UserInfo.Text = $"{_currentUser?.LastName} {_currentUser?.FirstName}";
|
||||||
|
|
||||||
|
var checkPoint = await _checkListService.GetCheckPoint(_checkPointCode);
|
||||||
|
|
||||||
|
if (checkPoint != null && checkPoint.IsSuccess)
|
||||||
|
{
|
||||||
|
HeaderLabel.Text = checkPoint.Data.ShortName;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
private async void OnSend()
|
private async void OnSend()
|
||||||
{
|
{
|
||||||
IsLoading = true;
|
IsLoading = true;
|
||||||
@@ -55,8 +69,6 @@ public partial class CheckListWorkPage : ContentPage
|
|||||||
{
|
{
|
||||||
OnSave();
|
OnSave();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
await Task.Run(async () =>
|
await Task.Run(async () =>
|
||||||
{
|
{
|
||||||
var result = await _syncService.SyncCheckListHeader_Up(_checkListHeaderId, (percentage, infostring) =>
|
var result = await _syncService.SyncCheckListHeader_Up(_checkListHeaderId, (percentage, infostring) =>
|
||||||
@@ -72,8 +84,7 @@ public partial class CheckListWorkPage : ContentPage
|
|||||||
{
|
{
|
||||||
if (Navigation.ModalStack.Count > 0)
|
if (Navigation.ModalStack.Count > 0)
|
||||||
{
|
{
|
||||||
//await Navigation.PopModalAsync();
|
await Navigation.PopModalAsync();
|
||||||
await Shell.Current.GoToAsync("//CheckListPage");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -83,6 +94,7 @@ public partial class CheckListWorkPage : ContentPage
|
|||||||
});
|
});
|
||||||
|
|
||||||
progressLabel.Text = "Szinkronizálás befejezve!";
|
progressLabel.Text = "Szinkronizálás befejezve!";
|
||||||
|
await Shell.Current.GoToAsync("//CheckListPage");
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@@ -132,9 +144,11 @@ public partial class CheckListWorkPage : ContentPage
|
|||||||
protected override async void OnAppearing()
|
protected override async void OnAppearing()
|
||||||
{
|
{
|
||||||
base.OnAppearing();
|
base.OnAppearing();
|
||||||
|
BindingContext = this;
|
||||||
|
await SetInfo();
|
||||||
CreatePhoto = new Command<CheckListRowDTO>(OnTakePhoto);
|
CreatePhoto = new Command<CheckListRowDTO>(OnTakePhoto);
|
||||||
await LoadCheckPointCheckListRows();
|
await LoadCheckPointCheckListRows();
|
||||||
BindingContext = this;
|
|
||||||
}
|
}
|
||||||
private async void OnTakePhoto(CheckListRowDTO checkListRowDTO)
|
private async void OnTakePhoto(CheckListRowDTO checkListRowDTO)
|
||||||
{
|
{
|
||||||
@@ -188,7 +202,7 @@ public partial class CheckListWorkPage : ContentPage
|
|||||||
IsLoading = true;
|
IsLoading = true;
|
||||||
|
|
||||||
CheckListRows.Clear();
|
CheckListRows.Clear();
|
||||||
var checkListRowDTOs = await _checkListService.GetCheckListRowsByCheckPointCode(_userDTO.Id, _checkListHeaderId, _checkPointCode);
|
var checkListRowDTOs = await _checkListService.GetCheckListRowsByCheckPointCode(_currentUser.Id, _checkListHeaderId, _checkPointCode);
|
||||||
foreach (var item in checkListRowDTOs)
|
foreach (var item in checkListRowDTOs)
|
||||||
{
|
{
|
||||||
if (item.Answer == "Igen")
|
if (item.Answer == "Igen")
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ public partial class NFCTestPage : ContentPage
|
|||||||
{
|
{
|
||||||
_currentUser = _userService.GetCurrentUser();
|
_currentUser = _userService.GetCurrentUser();
|
||||||
DeviceId.Text = _userService.DeviceId;
|
DeviceId.Text = _userService.DeviceId;
|
||||||
UserInfo.Text = $"{_currentUser?.FirstName} {_currentUser?.LastName}";
|
UserInfo.Text = $"{_currentUser?.LastName} {_currentUser?.FirstName}";
|
||||||
}
|
}
|
||||||
public ObservableCollection<NFCData> NFCDataList { get; set; }
|
public ObservableCollection<NFCData> NFCDataList { get; set; }
|
||||||
public ICommand RefreshCommand { get; set; }
|
public ICommand RefreshCommand { get; set; }
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using CommunityToolkit.Maui.Alerts;
|
using CommunityToolkit.Maui.Alerts;
|
||||||
using CommunityToolkit.Maui.Core;
|
using CommunityToolkit.Maui.Core;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
|
using WorkFlowCheck.MAUI.Helper;
|
||||||
using WorkFlowCheck.MAUI.Pages.NFC;
|
using WorkFlowCheck.MAUI.Pages.NFC;
|
||||||
using WorkFlowCheck.MAUI.Services.Interfaces;
|
using WorkFlowCheck.MAUI.Services.Interfaces;
|
||||||
|
|
||||||
@@ -32,6 +33,8 @@ public partial class LoginPage : BasePage
|
|||||||
{
|
{
|
||||||
_userService.SetCurrentUser(response.Data);
|
_userService.SetCurrentUser(response.Data);
|
||||||
|
|
||||||
|
SystemHelper.SystemUserDTO = response.Data;
|
||||||
|
|
||||||
//await _syncService.SyncDatas();
|
//await _syncService.SyncDatas();
|
||||||
|
|
||||||
var wFCUser = Newtonsoft.Json.JsonConvert.SerializeObject(response.Data);
|
var wFCUser = Newtonsoft.Json.JsonConvert.SerializeObject(response.Data);
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ public partial class DownloadAPKPage : ContentPage
|
|||||||
{
|
{
|
||||||
_currentUser = _userService.GetCurrentUser();
|
_currentUser = _userService.GetCurrentUser();
|
||||||
DeviceId.Text = _userService.DeviceId;
|
DeviceId.Text = _userService.DeviceId;
|
||||||
UserInfo.Text = $"{_currentUser?.FirstName} {_currentUser?.LastName}";
|
UserInfo.Text = $"{_currentUser?.LastName} {_currentUser?.FirstName}";
|
||||||
}
|
}
|
||||||
private async void OnSyncClicked(object sender, EventArgs e)
|
private async void OnSyncClicked(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ public partial class SyncPage : ContentPage
|
|||||||
{
|
{
|
||||||
_currentUser = _userService.GetCurrentUser();
|
_currentUser = _userService.GetCurrentUser();
|
||||||
DeviceId.Text = _userService.DeviceId;
|
DeviceId.Text = _userService.DeviceId;
|
||||||
UserInfo.Text = $"{_currentUser?.FirstName} {_currentUser?.LastName}";
|
UserInfo.Text = $"{_currentUser?.LastName} {_currentUser?.FirstName}";
|
||||||
}
|
}
|
||||||
private async void OnSyncClicked(object sender, EventArgs e)
|
private async void OnSyncClicked(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -267,6 +267,33 @@ namespace WorkFlowCheck.MAUI.Services
|
|||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
return retVal;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<CheckPointDTO> GetNextCheckpointNotSend(CheckListHeaderDTO checkListHeaderDTO)
|
||||||
|
{
|
||||||
|
var retVal = new CheckPointDTO();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var firstUnansweredCheckPoint = await _dbContext.CheckListRows
|
||||||
|
.Include(i => i.CheckListTemplateRow)
|
||||||
|
.ThenInclude(i => i.CheckPoint)
|
||||||
|
.Where(w => w.CheckListHeaderId == checkListHeaderDTO.Id
|
||||||
|
&& string.IsNullOrEmpty(w.Answer.Trim()))
|
||||||
|
.Select(w => w.CheckListTemplateRow.CheckPoint)
|
||||||
|
.OrderBy(cp => cp.ShortName)
|
||||||
|
.FirstOrDefaultAsync();
|
||||||
|
|
||||||
|
if (firstUnansweredCheckPoint != null)
|
||||||
|
{
|
||||||
|
retVal = _mapper.Map<CheckPointDTO>(firstUnansweredCheckPoint);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,5 +22,6 @@ namespace WorkFlowCheck.MAUI.Services.Interfaces
|
|||||||
Task<bool> UnBlockCheckListHeader(CheckListHeaderDTO checkListHeaderDTO);
|
Task<bool> UnBlockCheckListHeader(CheckListHeaderDTO checkListHeaderDTO);
|
||||||
Task<bool> BlockCheckListHeader(CheckListHeaderDTO checkListHeaderDTO);
|
Task<bool> BlockCheckListHeader(CheckListHeaderDTO checkListHeaderDTO);
|
||||||
Task<bool> AcceptCheckListHeader(CheckListHeaderDTO checkListHeaderDTO);
|
Task<bool> AcceptCheckListHeader(CheckListHeaderDTO checkListHeaderDTO);
|
||||||
|
Task<CheckPointDTO> GetNextCheckpointNotSend(CheckListHeaderDTO checkListHeaderDTO);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user