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 Code { get; set; } = null!;
public virtual ICollection<CheckListTemplateRow> CheckListTemplateRows { get; set; } = new List<CheckListTemplateRow>();
}
}
@@ -13,7 +13,7 @@ namespace WorkFlowCheck.MAUI.Mapper
{
public MapperProfile()
{
CreateMap<CheckPoint, CheckPointDTO>();
CreateMap<CheckPoint, CheckPointDTO>().ForMember(dest => dest.CheckListTemplateRowDTO, opt => opt.MapFrom(src => src.CheckListTemplateRows));
CreateMap<CheckPointDTO, CheckPoint>();
CreateMap<CheckListTemplateHeaderDTO, CheckListTemplateHeader>()
@@ -2,16 +2,19 @@
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="WorkFlowCheck.MAUI.Pages.BaseStock.CheckPoints.CheckPointEditPage"
Title="CheckPointEditPage">
Title="{Binding CheckPointDTO.ShortName}">
<StackLayout Padding="20">
<!-- 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ő -->
<Entry Text="{Binding CheckPointDTO.ShortName}" Placeholder="Edit item name" />
<Entry Text="{Binding CheckPointDTO.Code}" Placeholder="Edit item name" />
<Grid ColumnSpacing="10">
<Frame BorderColor="Gray" Padding="5" Margin="1" HasShadow="True">
<VerticalStackLayout>
<!-- Editálható név mező -->
<Entry Text="{Binding CheckPointDTO.ShortName}" Placeholder="Edit item name" />
<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 -->
<Grid.ColumnDefinitions>
<ColumnDefinition Width="200" />
@@ -23,5 +26,19 @@
<Button Text="Save" Command="{Binding SaveCommand}" Grid.Column="0"/>
<Button Text="Cancel" Command="{Binding CancelCommand}" Grid.Column="2"/>
</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>
</ContentPage>
@@ -19,6 +19,15 @@ public partial class CheckPointEditPage : ContentPage
SaveCommand = new Command(OnSave);
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()
{
@@ -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()
{
if (_eventsAlreadySubscribed)
@@ -106,8 +123,8 @@ public partial class CheckPointsPage : ContentPage
{
_checkPointDTO.Code = serialNumber;
await _baseStockService.UpdateCheckPoint(_checkPointDTO);
//CrossNFC.Current.StopListening();
UnsubscribeEvents();
await Task.Delay(500);
await EndListening();
await LoadCheckPoints();
}
_onReceiveing = false;
@@ -8,7 +8,7 @@
<StackLayout Padding="20" VerticalOptions="Center">
<Entry x:Name="UsernameEntry" Placeholder="Felhasználói név" />
<Entry x:Name="PasswordEntry" Placeholder="PIN kód" IsPassword="True" Keyboard="Numeric"/>
<dx:PasswordEdit
<!--<dx:PasswordEdit
Text="{Binding Password, Mode=TwoWay}"
HasError="{Binding PasswordHasError}"
LabelText="Password"
@@ -16,7 +16,7 @@
Keyboard="Numeric"
ErrorText="The password should contain more than 5 characters,
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" />
<ActivityIndicator x:Name="LoadingIndicator"
IsRunning="False"
@@ -135,7 +135,7 @@
<Style TargetType="Frame">
<Setter Property="HasShadow" Value="False" />
<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}}" />
</Style>
@@ -1,4 +1,5 @@
using AutoMapper;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Newtonsoft.Json;
using System.Net.Http.Json;
@@ -16,6 +17,22 @@ namespace WorkFlowCheck.MAUI.Services
_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)
{
try
@@ -10,5 +10,6 @@ namespace WorkFlowCheck.MAUI.Services.Interfaces
public interface ICheckListService
{
Task<ApiResponseDTO<CheckListHeaderDTO>> StartNew(CheckListTemplateHeaderDTO checkListTemplateHeaderDTO);
Task<ApiResponseDTO<CheckPointDTO>> GetCheckPoint(int checkPointId);
}
}