Lejönnek a CheckPointhoz tartozó sorok

This commit is contained in:
2025-03-10 09:32:39 +01:00
parent af607f6079
commit 943e2a716d
9 changed files with 75 additions and 14 deletions
@@ -12,6 +12,6 @@ namespace WorkFlowCheck.MAUI.DataLayer.Entities
public string ShortName { get; set; } = null!; public string ShortName { get; set; } = null!;
public string Code { get; set; } = null!; public string Code { get; set; } = null!;
public virtual ICollection<CheckListTemplateRow> CheckListTemplateRows { get; set; } = new List<CheckListTemplateRow>();
} }
} }
@@ -13,7 +13,7 @@ namespace WorkFlowCheck.MAUI.Mapper
{ {
public MapperProfile() public MapperProfile()
{ {
CreateMap<CheckPoint, CheckPointDTO>(); CreateMap<CheckPoint, CheckPointDTO>().ForMember(dest => dest.CheckListTemplateRowDTO, opt => opt.MapFrom(src => src.CheckListTemplateRows));
CreateMap<CheckPointDTO, CheckPoint>(); CreateMap<CheckPointDTO, CheckPoint>();
CreateMap<CheckListTemplateHeaderDTO, CheckListTemplateHeader>() CreateMap<CheckListTemplateHeaderDTO, CheckListTemplateHeader>()
@@ -2,16 +2,19 @@
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui" <ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="WorkFlowCheck.MAUI.Pages.BaseStock.CheckPoints.CheckPointEditPage" x:Class="WorkFlowCheck.MAUI.Pages.BaseStock.CheckPoints.CheckPointEditPage"
Title="CheckPointEditPage"> Title="{Binding CheckPointDTO.ShortName}">
<StackLayout Padding="20"> <StackLayout Padding="20">
<!-- Cím: Edit Item --> <!-- Cím: Edit Item -->
<Label Text="Edit Item" FontSize="24" HorizontalOptions="Center" /> <Label Text="Ellenőrzési pont adatai" FontSize="24" HorizontalOptions="Center" />
<!-- Editálható név mező --> <Frame BorderColor="Gray" Padding="5" Margin="1" HasShadow="True">
<Entry Text="{Binding CheckPointDTO.ShortName}" Placeholder="Edit item name" /> <VerticalStackLayout>
<Entry Text="{Binding CheckPointDTO.Code}" Placeholder="Edit item name" /> <!-- Editálható név mező -->
<Entry Text="{Binding CheckPointDTO.ShortName}" Placeholder="Edit item name" />
<Grid ColumnSpacing="10"> <Entry Text="{Binding CheckPointDTO.Code}" Placeholder="Edit item name" />
</VerticalStackLayout>
</Frame>
<Grid ColumnSpacing="46" Margin="0,10,0,10">
<!-- 10 pixel térköz az oszlopok között --> <!-- 10 pixel térköz az oszlopok között -->
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="200" /> <ColumnDefinition Width="200" />
@@ -23,5 +26,19 @@
<Button Text="Save" Command="{Binding SaveCommand}" Grid.Column="0"/> <Button Text="Save" Command="{Binding SaveCommand}" Grid.Column="0"/>
<Button Text="Cancel" Command="{Binding CancelCommand}" Grid.Column="2"/> <Button Text="Cancel" Command="{Binding CancelCommand}" Grid.Column="2"/>
</Grid> </Grid>
<Label Text="Ellenőrzési feladatok" FontAttributes="Bold" FontSize="Medium" HorizontalOptions="Center" />
<Frame BorderColor="Gray" Padding="10" Margin="5" HasShadow="True" CornerRadius="2">
<CollectionView x:Name="CheckPointCheckListRows" HeightRequest="440">
<CollectionView.ItemTemplate>
<DataTemplate>
<Frame BorderColor="Gray" Padding="10" Margin="5" HasShadow="True" CornerRadius="2">
<StackLayout>
<Label Text="{Binding OperationDescription}" FontSize="16" FontAttributes="Bold" />
</StackLayout>
</Frame>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
</Frame>
</StackLayout> </StackLayout>
</ContentPage> </ContentPage>
@@ -19,6 +19,15 @@ public partial class CheckPointEditPage : ContentPage
SaveCommand = new Command(OnSave); SaveCommand = new Command(OnSave);
CancelCommand = new Command(OnCancel); CancelCommand = new Command(OnCancel);
LoadCheckPointCheckListRows();
}
private void LoadCheckPointCheckListRows()
{
//IsRefreshing = true;
//await _syncService.SyncDatas();
CheckPointCheckListRows.ItemsSource = CheckPointDTO.CheckListTemplateRowDTO;
//IsRefreshing = false;
//OnPropertyChanged(nameof(IsRefreshing));
} }
private async void OnSave() private async void OnSave()
{ {
@@ -78,6 +78,23 @@ public partial class CheckPointsPage : ContentPage
} }
} }
async Task EndListening()
{
try
{
MainThread.BeginInvokeOnMainThread(() =>
{
UnsubscribeEvents();
CrossNFC.Current.StopPublishing();
CrossNFC.Current.StopListening();
});
}
catch (Exception ex)
{
}
}
void SubscribeEvents() void SubscribeEvents()
{ {
if (_eventsAlreadySubscribed) if (_eventsAlreadySubscribed)
@@ -106,8 +123,8 @@ public partial class CheckPointsPage : ContentPage
{ {
_checkPointDTO.Code = serialNumber; _checkPointDTO.Code = serialNumber;
await _baseStockService.UpdateCheckPoint(_checkPointDTO); await _baseStockService.UpdateCheckPoint(_checkPointDTO);
//CrossNFC.Current.StopListening(); await Task.Delay(500);
UnsubscribeEvents(); await EndListening();
await LoadCheckPoints(); await LoadCheckPoints();
} }
_onReceiveing = false; _onReceiveing = false;
@@ -8,7 +8,7 @@
<StackLayout Padding="20" VerticalOptions="Center"> <StackLayout Padding="20" VerticalOptions="Center">
<Entry x:Name="UsernameEntry" Placeholder="Felhasználói név" /> <Entry x:Name="UsernameEntry" Placeholder="Felhasználói név" />
<Entry x:Name="PasswordEntry" Placeholder="PIN kód" IsPassword="True" Keyboard="Numeric"/> <Entry x:Name="PasswordEntry" Placeholder="PIN kód" IsPassword="True" Keyboard="Numeric"/>
<dx:PasswordEdit <!--<dx:PasswordEdit
Text="{Binding Password, Mode=TwoWay}" Text="{Binding Password, Mode=TwoWay}"
HasError="{Binding PasswordHasError}" HasError="{Binding PasswordHasError}"
LabelText="Password" LabelText="Password"
@@ -16,7 +16,7 @@
Keyboard="Numeric" Keyboard="Numeric"
ErrorText="The password should contain more than 5 characters, ErrorText="The password should contain more than 5 characters,
have at least one uppercase and one lowercase letter, and one number." have at least one uppercase and one lowercase letter, and one number."
PlaceholderText="Enter password"/> PlaceholderText="Enter password"/>-->
<Button x:Name="LoginBtn" Text="Bejelentkezés" Clicked="OnLoginClicked" /> <Button x:Name="LoginBtn" Text="Bejelentkezés" Clicked="OnLoginClicked" />
<ActivityIndicator x:Name="LoadingIndicator" <ActivityIndicator x:Name="LoadingIndicator"
IsRunning="False" IsRunning="False"
@@ -135,7 +135,7 @@
<Style TargetType="Frame"> <Style TargetType="Frame">
<Setter Property="HasShadow" Value="False" /> <Setter Property="HasShadow" Value="False" />
<Setter Property="BorderColor" Value="{AppThemeBinding Light={StaticResource Gray200}, Dark={StaticResource Gray950}}" /> <Setter Property="BorderColor" Value="{AppThemeBinding Light={StaticResource Gray200}, Dark={StaticResource Gray950}}" />
<Setter Property="CornerRadius" Value="8" /> <Setter Property="CornerRadius" Value="2" />
<Setter Property="BackgroundColor" Value="{AppThemeBinding Light={StaticResource White}, Dark={StaticResource Black}}" /> <Setter Property="BackgroundColor" Value="{AppThemeBinding Light={StaticResource White}, Dark={StaticResource Black}}" />
</Style> </Style>
@@ -1,4 +1,5 @@
using AutoMapper; using AutoMapper;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration;
using Newtonsoft.Json; using Newtonsoft.Json;
using System.Net.Http.Json; using System.Net.Http.Json;
@@ -16,6 +17,22 @@ namespace WorkFlowCheck.MAUI.Services
_userService = userService; _userService = userService;
} }
public async Task<ApiResponseDTO<CheckPointDTO>> GetCheckPoint(int checkPointId)
{
var retVal = new ApiResponseDTO<CheckPointDTO>() { IsSuccess = true };
try
{
var res = await _dbContext.CheckPoints.Include(i => i.CheckListTemplateRows).Where(w => w.Id == checkPointId).FirstOrDefaultAsync();
retVal.Data = _mapper.Map<CheckPointDTO>(res);
}
catch (Exception ex)
{
retVal.IsSuccess = false;
retVal.Errors.Add(ex.Message);
}
return retVal;
}
public async Task<ApiResponseDTO<CheckListHeaderDTO>> StartNew(CheckListTemplateHeaderDTO checkListTemplateHeaderDTO) public async Task<ApiResponseDTO<CheckListHeaderDTO>> StartNew(CheckListTemplateHeaderDTO checkListTemplateHeaderDTO)
{ {
try try
@@ -10,5 +10,6 @@ namespace WorkFlowCheck.MAUI.Services.Interfaces
public interface ICheckListService public interface ICheckListService
{ {
Task<ApiResponseDTO<CheckListHeaderDTO>> StartNew(CheckListTemplateHeaderDTO checkListTemplateHeaderDTO); Task<ApiResponseDTO<CheckListHeaderDTO>> StartNew(CheckListTemplateHeaderDTO checkListTemplateHeaderDTO);
Task<ApiResponseDTO<CheckPointDTO>> GetCheckPoint(int checkPointId);
} }
} }