New version
This commit is contained in:
parent
6b6c90272c
commit
49038de2b5
55
.gitignore
vendored
Normal file
55
.gitignore
vendored
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
# These are some examples of commonly ignored file patterns.
|
||||||
|
# You should customize this list as applicable to your project.
|
||||||
|
# Learn more about .gitignore:
|
||||||
|
# https://www.atlassian.com/git/tutorials/saving-changes/gitignore
|
||||||
|
|
||||||
|
# Node artifact files
|
||||||
|
node_modules/
|
||||||
|
dist/
|
||||||
|
|
||||||
|
# Compiled Java class files
|
||||||
|
*.class
|
||||||
|
|
||||||
|
# Compiled Python bytecode
|
||||||
|
*.py[cod]
|
||||||
|
|
||||||
|
# Log files
|
||||||
|
*.log
|
||||||
|
|
||||||
|
# Package files
|
||||||
|
*.jar
|
||||||
|
|
||||||
|
# Maven
|
||||||
|
target/
|
||||||
|
dist/
|
||||||
|
|
||||||
|
# JetBrains IDE
|
||||||
|
.idea/
|
||||||
|
|
||||||
|
# Unit test reports
|
||||||
|
TEST*.xml
|
||||||
|
|
||||||
|
# Generated by MacOS
|
||||||
|
.DS_Store
|
||||||
|
|
||||||
|
# Generated by Windows
|
||||||
|
Thumbs.db
|
||||||
|
|
||||||
|
# Applications
|
||||||
|
*.app
|
||||||
|
*.exe
|
||||||
|
*.war
|
||||||
|
|
||||||
|
# Large media files
|
||||||
|
*.mp4
|
||||||
|
*.tiff
|
||||||
|
*.avi
|
||||||
|
*.flv
|
||||||
|
*.mov
|
||||||
|
*.wmv
|
||||||
|
|
||||||
|
.vs
|
||||||
|
*/bin
|
||||||
|
*/obj
|
||||||
|
Drab/.config
|
||||||
|
Drab/drab.db
|
||||||
9
Drab.Core/Configuration/DrabSettings.cs
Normal file
9
Drab.Core/Configuration/DrabSettings.cs
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
namespace Drab.Core.Configuration;
|
||||||
|
|
||||||
|
public class DrabSettings : IDrabSettings
|
||||||
|
{
|
||||||
|
public const string SectionName = "DrabSettings";
|
||||||
|
public int DbPollingFrequencyInSeconds { get; set; }
|
||||||
|
public int PrinterTimeoutSeconds { get; set; }
|
||||||
|
public string IgnoreOrdersBefore { get; set; }
|
||||||
|
}
|
||||||
8
Drab.Core/Configuration/IDrabSettings.cs
Normal file
8
Drab.Core/Configuration/IDrabSettings.cs
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
namespace Drab.Core.Configuration;
|
||||||
|
|
||||||
|
public interface IDrabSettings
|
||||||
|
{
|
||||||
|
int DbPollingFrequencyInSeconds { get; }
|
||||||
|
int PrinterTimeoutSeconds { get; }
|
||||||
|
public string IgnoreOrdersBefore { get; set; }
|
||||||
|
}
|
||||||
9
Drab.Core/Configuration/LocalDbConfiguration.cs
Normal file
9
Drab.Core/Configuration/LocalDbConfiguration.cs
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
using Drab.LocalDb.IoC;
|
||||||
|
|
||||||
|
namespace Drab.Core.Configuration;
|
||||||
|
|
||||||
|
public class LocalDbConfiguration : ILocalDbConfiguration
|
||||||
|
{
|
||||||
|
public const string SectionName = "LocalDbConnection";
|
||||||
|
public string ConnectionString { get; set; }
|
||||||
|
}
|
||||||
13
Drab.Core/Configuration/PcmDbConfiguration.cs
Normal file
13
Drab.Core/Configuration/PcmDbConfiguration.cs
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
using Pcm.Db.Ioc;
|
||||||
|
|
||||||
|
namespace Drab.Core.Configuration;
|
||||||
|
|
||||||
|
public class PcmDbConfiguration : IDbConfiguration
|
||||||
|
{
|
||||||
|
public const string SectionName = "PcmDbSettings";
|
||||||
|
public string Host { get; set; }
|
||||||
|
public string Port { get; set; }
|
||||||
|
public string User { get; set; }
|
||||||
|
public string Password { get; set; }
|
||||||
|
public string Database { get; set; }
|
||||||
|
}
|
||||||
17
Drab.Core/Drab.Core.csproj
Normal file
17
Drab.Core/Drab.Core.csproj
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net9.0-windows</TargetFramework>
|
||||||
|
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\Drab.LocalDb\Drab.LocalDb.csproj"/>
|
||||||
|
<ProjectReference Include="..\Pcm.Db\Pcm.Db.csproj"/>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="NLog" Version="6.0.1"/>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
13
Drab.Core/Ioc/IocCoreRegister.cs
Normal file
13
Drab.Core/Ioc/IocCoreRegister.cs
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
using Drab.Core.Configuration;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
|
||||||
|
namespace Drab.Core.Ioc;
|
||||||
|
|
||||||
|
public static class IocCoreRegister
|
||||||
|
{
|
||||||
|
public static IServiceCollection AddDrabCore(this IServiceCollection services, IDrabSettings settings)
|
||||||
|
{
|
||||||
|
services.AddSingleton(settings);
|
||||||
|
return services;
|
||||||
|
}
|
||||||
|
}
|
||||||
82
Drab.Core/Models/Result.cs
Normal file
82
Drab.Core/Models/Result.cs
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace Drab.Core.Models;
|
||||||
|
|
||||||
|
public class Result<TOk, TBad>
|
||||||
|
{
|
||||||
|
private TBad _error;
|
||||||
|
private TOk _ok;
|
||||||
|
public bool IsOk { get; }
|
||||||
|
public bool IsNotOk => !IsOk;
|
||||||
|
|
||||||
|
public Result(bool isOk, TOk ok, TBad bad)
|
||||||
|
{
|
||||||
|
IsOk = isOk;
|
||||||
|
|
||||||
|
if (IsOk)
|
||||||
|
{
|
||||||
|
if (ok == null)
|
||||||
|
throw new ArgumentNullException(nameof(ok), "If IsOk flag is set to true parameter 'ok' needs to be non null");
|
||||||
|
|
||||||
|
Value = ok;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (bad == null)
|
||||||
|
throw new ArgumentNullException(nameof(bad), "If IsOk flag is set to false parameter 'bad' needs to be non null");
|
||||||
|
|
||||||
|
Error = bad;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public TBad Error
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (IsOk)
|
||||||
|
throw new InvalidOperationException("Result has IsOk flag set to true only Value property is available");
|
||||||
|
return _error;
|
||||||
|
}
|
||||||
|
private set => _error = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TOk Value
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (!IsOk)
|
||||||
|
throw new InvalidOperationException("Result has IsOk flag set to false only Error property is available");
|
||||||
|
return _ok;
|
||||||
|
}
|
||||||
|
private set => _ok = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Result<TNew, TBad> Map<TNew>(Func<TOk, TNew> map) where TNew : class
|
||||||
|
{
|
||||||
|
if (IsOk)
|
||||||
|
return new Result<TNew, TBad>(IsOk, map(Value), default);
|
||||||
|
else
|
||||||
|
return new Result<TNew, TBad>(false, default, Error);
|
||||||
|
}
|
||||||
|
|
||||||
|
public TOk ValueWithDefault(Func<TBad, TOk> defaultCreator) => IsOk ? Value : defaultCreator(Error);
|
||||||
|
|
||||||
|
public void Do(Action<TOk> action)
|
||||||
|
{
|
||||||
|
if (IsOk)
|
||||||
|
action(Value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class Result
|
||||||
|
{
|
||||||
|
public static Result<T, TK> Failed<T, TK>(TK wrong)
|
||||||
|
{
|
||||||
|
return new Result<T, TK>(false, default(T), wrong);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Result<T, TK> Ok<T, TK>(T ok)
|
||||||
|
{
|
||||||
|
return new Result<T, TK>(true, ok, default(TK));
|
||||||
|
}
|
||||||
|
}
|
||||||
19
Drab.LocalDb/Drab.LocalDb.csproj
Normal file
19
Drab.LocalDb/Drab.LocalDb.csproj
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net9.0-windows</TargetFramework>
|
||||||
|
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="9.0.7"/>
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="9.0.7"/>
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="9.0.7"/>
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Design" Version="1.1.6"/>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Folder Include="Migrations"/>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
16
Drab.LocalDb/Entities/OrderDb.cs
Normal file
16
Drab.LocalDb/Entities/OrderDb.cs
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
using System;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
|
namespace Drab.LocalDb.Entities;
|
||||||
|
|
||||||
|
public class OrderDb
|
||||||
|
{
|
||||||
|
[Key]
|
||||||
|
public long OrderId { get; set; }
|
||||||
|
public long DokId { get; set; }
|
||||||
|
public DateTime Created { get; set; }
|
||||||
|
public bool IsPrinted { get; set; }
|
||||||
|
public string Filename { get; set; }
|
||||||
|
public string Shop { get; set; }
|
||||||
|
public string OrderNumber { get; set; }
|
||||||
|
}
|
||||||
6
Drab.LocalDb/IoC/ILocalDbConfiguration.cs
Normal file
6
Drab.LocalDb/IoC/ILocalDbConfiguration.cs
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
namespace Drab.LocalDb.IoC;
|
||||||
|
|
||||||
|
public interface ILocalDbConfiguration
|
||||||
|
{
|
||||||
|
public string ConnectionString { get; set; }
|
||||||
|
}
|
||||||
13
Drab.LocalDb/IoC/IocLocalDbRegister.cs
Normal file
13
Drab.LocalDb/IoC/IocLocalDbRegister.cs
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
|
||||||
|
namespace Drab.LocalDb.IoC;
|
||||||
|
|
||||||
|
public static class IocLocalDbRegister
|
||||||
|
{
|
||||||
|
public static IServiceCollection AddLocalDatabase(this IServiceCollection services, ILocalDbConfiguration localDbConfiguration)
|
||||||
|
{
|
||||||
|
services.AddDbContext<LocalDbContext>(cx => cx.UseSqlite(localDbConfiguration.ConnectionString));
|
||||||
|
return services;
|
||||||
|
}
|
||||||
|
}
|
||||||
18
Drab.LocalDb/LocalDbContext.cs
Normal file
18
Drab.LocalDb/LocalDbContext.cs
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
using Drab.LocalDb.Entities;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
|
namespace Drab.LocalDb;
|
||||||
|
|
||||||
|
public class LocalDbContext : DbContext
|
||||||
|
{
|
||||||
|
public LocalDbContext()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public LocalDbContext(DbContextOptions<LocalDbContext> options)
|
||||||
|
: base(options)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public DbSet<OrderDb> Orders { get; set; }
|
||||||
|
}
|
||||||
52
Drab.LocalDb/Migrations/20211101180516_Initial.Designer.cs
generated
Normal file
52
Drab.LocalDb/Migrations/20211101180516_Initial.Designer.cs
generated
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
// <auto-generated />
|
||||||
|
using System;
|
||||||
|
using Drab.LocalDb;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
|
|
||||||
|
namespace Drab.LocalDb.Migrations
|
||||||
|
{
|
||||||
|
[DbContext(typeof(LocalDbContext))]
|
||||||
|
[Migration("20211101180516_Initial")]
|
||||||
|
partial class Initial
|
||||||
|
{
|
||||||
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
#pragma warning disable 612, 618
|
||||||
|
modelBuilder
|
||||||
|
.HasAnnotation("ProductVersion", "5.0.11");
|
||||||
|
|
||||||
|
modelBuilder.Entity("Drab.LocalDb.Entities.OrderDb", b =>
|
||||||
|
{
|
||||||
|
b.Property<long>("OrderId")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<DateTime>("Created")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<long>("DokId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("Filename")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<bool>("IsPrinted")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("OrderNumber")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("Shop")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.HasKey("OrderId");
|
||||||
|
|
||||||
|
b.ToTable("Orders");
|
||||||
|
});
|
||||||
|
#pragma warning restore 612, 618
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
35
Drab.LocalDb/Migrations/20211101180516_Initial.cs
Normal file
35
Drab.LocalDb/Migrations/20211101180516_Initial.cs
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
namespace Drab.LocalDb.Migrations
|
||||||
|
{
|
||||||
|
public partial class Initial : Migration
|
||||||
|
{
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "Orders",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
OrderId = table.Column<long>(type: "INTEGER", nullable: false)
|
||||||
|
.Annotation("Sqlite:Autoincrement", true),
|
||||||
|
DokId = table.Column<long>(type: "INTEGER", nullable: false),
|
||||||
|
Created = table.Column<DateTime>(type: "TEXT", nullable: false),
|
||||||
|
IsPrinted = table.Column<bool>(type: "INTEGER", nullable: false),
|
||||||
|
Filename = table.Column<string>(type: "TEXT", nullable: true),
|
||||||
|
Shop = table.Column<string>(type: "TEXT", nullable: true),
|
||||||
|
OrderNumber = table.Column<string>(type: "TEXT", nullable: true)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Orders", x => x.OrderId);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Orders");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
50
Drab.LocalDb/Migrations/LocalDbContextModelSnapshot.cs
Normal file
50
Drab.LocalDb/Migrations/LocalDbContextModelSnapshot.cs
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
// <auto-generated />
|
||||||
|
using System;
|
||||||
|
using Drab.LocalDb;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
|
|
||||||
|
namespace Drab.LocalDb.Migrations
|
||||||
|
{
|
||||||
|
[DbContext(typeof(LocalDbContext))]
|
||||||
|
partial class LocalDbContextModelSnapshot : ModelSnapshot
|
||||||
|
{
|
||||||
|
protected override void BuildModel(ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
#pragma warning disable 612, 618
|
||||||
|
modelBuilder
|
||||||
|
.HasAnnotation("ProductVersion", "5.0.11");
|
||||||
|
|
||||||
|
modelBuilder.Entity("Drab.LocalDb.Entities.OrderDb", b =>
|
||||||
|
{
|
||||||
|
b.Property<long>("OrderId")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<DateTime>("Created")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<long>("DokId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("Filename")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<bool>("IsPrinted")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("OrderNumber")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("Shop")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.HasKey("OrderId");
|
||||||
|
|
||||||
|
b.ToTable("Orders");
|
||||||
|
});
|
||||||
|
#pragma warning restore 612, 618
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
11
Drab.Logic/Constants.cs
Normal file
11
Drab.Logic/Constants.cs
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
using Drab.Logic.Services;
|
||||||
|
using System.IO;
|
||||||
|
using System.Reflection;
|
||||||
|
|
||||||
|
namespace Drab.Logic;
|
||||||
|
|
||||||
|
internal static class Constants
|
||||||
|
{
|
||||||
|
internal static readonly string ReportsTemplatesPath = Path.Combine(Path.GetDirectoryName(Assembly.GetAssembly(typeof(OrderPdfGenerator)).Location), "Templates");
|
||||||
|
internal static readonly string ReportsOutputPath = Path.Combine(Path.GetDirectoryName(Assembly.GetAssembly(typeof(OrderPdfGenerator)).Location), "Orders");
|
||||||
|
}
|
||||||
42
Drab.Logic/Drab.Logic.csproj
Normal file
42
Drab.Logic/Drab.Logic.csproj
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net9.0-windows</TargetFramework>
|
||||||
|
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="System.Printing">
|
||||||
|
<HintPath>./System.Printing.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="FastReport.OpenSource" Version="2025.2.0"/>
|
||||||
|
<PackageReference Include="FastReport.OpenSource.Export.PdfSimple" Version="2025.2.0"/>
|
||||||
|
<PackageReference Include="FastReport.OpenSource.Web" Version="2025.2.0"/>
|
||||||
|
<PackageReference Include="Microsoft.AspNetCore.SignalR" Version="1.2.0"/>
|
||||||
|
<PackageReference Include="NLog" Version="6.0.1"/>
|
||||||
|
<PackageReference Include="PdfiumViewer" Version="2.13.0"/>
|
||||||
|
<PackageReference Include="PdfiumViewer.Native.x86_64.v8-xfa" Version="2018.4.8.256"/>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\Drab.Core\Drab.Core.csproj"/>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Folder Include="Templates"/>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<None Update="Templates\Order.frx">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Update="pdfium.dll">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Update="System.Printing.dll">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
32
Drab.Logic/Dtos/DokDto.cs
Normal file
32
Drab.Logic/Dtos/DokDto.cs
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
using Pcm.Db.Entities;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
|
namespace Drab.Logic.Dtos;
|
||||||
|
|
||||||
|
public class DokDto
|
||||||
|
{
|
||||||
|
public long DokId { get; set; }
|
||||||
|
public string NrDok { get; set; }
|
||||||
|
public DateTime Data { get; set; }
|
||||||
|
public string Sklep { get; set; }
|
||||||
|
public IEnumerable<PozDokDto> PozDok { get; set; }
|
||||||
|
public string Opis { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
internal static class DokExtensions
|
||||||
|
{
|
||||||
|
internal static DokDto ToDokDto(this Dok dok)
|
||||||
|
{
|
||||||
|
return new DokDto
|
||||||
|
{
|
||||||
|
DokId = (long)dok.DokId,
|
||||||
|
Data = dok.Zmiana,
|
||||||
|
NrDok = dok.NrDok,
|
||||||
|
Sklep = dok.DokKontr.Kontr.Nazwa,
|
||||||
|
Opis = string.Join(' ', dok.TekstDoks.Select(x => x.Tekst)),
|
||||||
|
PozDok = dok.PozDoks.Select(x => x.ToPozDokDto()).ToList()
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
23
Drab.Logic/Dtos/MagDto.cs
Normal file
23
Drab.Logic/Dtos/MagDto.cs
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
using Pcm.Db.Entities;
|
||||||
|
|
||||||
|
namespace Drab.Logic.Dtos;
|
||||||
|
|
||||||
|
public class MagDto
|
||||||
|
{
|
||||||
|
public long MagId { get; set; }
|
||||||
|
public string Nazwa { get; set; }
|
||||||
|
public short Numer { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
internal static class MagazynExtensions
|
||||||
|
{
|
||||||
|
internal static MagDto ToMagDto(this Magazyn magazyn)
|
||||||
|
{
|
||||||
|
return new MagDto
|
||||||
|
{
|
||||||
|
MagId = (long)magazyn.MagId,
|
||||||
|
Numer = magazyn.Numer ?? 0,
|
||||||
|
Nazwa = magazyn.Nazwa
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
26
Drab.Logic/Dtos/PozDokDto.cs
Normal file
26
Drab.Logic/Dtos/PozDokDto.cs
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
using System.Linq;
|
||||||
|
using Pcm.Db.Entities;
|
||||||
|
|
||||||
|
namespace Drab.Logic.Dtos;
|
||||||
|
|
||||||
|
public class PozDokDto
|
||||||
|
{
|
||||||
|
public long DokId { get; set; }
|
||||||
|
public TowarDto Towar { get; set; }
|
||||||
|
public decimal Ilosc { get; set; }
|
||||||
|
public string Komentarz { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
internal static class PozDokExtensions
|
||||||
|
{
|
||||||
|
internal static PozDokDto ToPozDokDto(this PozDok pozDok)
|
||||||
|
{
|
||||||
|
return new PozDokDto
|
||||||
|
{
|
||||||
|
DokId = (long)pozDok.DokId,
|
||||||
|
Ilosc = pozDok.IloscPlus,
|
||||||
|
Towar = pozDok.Tow.ToTowarDto(),
|
||||||
|
Komentarz = string.Join("; ", pozDok.TekstPozs.Select(x => x.Tekst.Trim()))
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
25
Drab.Logic/Dtos/TowarDto.cs
Normal file
25
Drab.Logic/Dtos/TowarDto.cs
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
using Pcm.Db.Entities;
|
||||||
|
|
||||||
|
namespace Drab.Logic.Dtos;
|
||||||
|
|
||||||
|
public class TowarDto
|
||||||
|
{
|
||||||
|
public long TowId { get; set; }
|
||||||
|
public string Nazwa { get; set; }
|
||||||
|
public string Kod { get; set; }
|
||||||
|
public string Jm { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
internal static class TowarExtension
|
||||||
|
{
|
||||||
|
internal static TowarDto ToTowarDto(this Towar towar)
|
||||||
|
{
|
||||||
|
return new TowarDto
|
||||||
|
{
|
||||||
|
TowId = (long)towar.TowId,
|
||||||
|
Nazwa = towar.Nazwa,
|
||||||
|
Kod = towar.Kod,
|
||||||
|
Jm = towar.Jm.Nazwa
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
8
Drab.Logic/Interfaces/IDbFetcher.cs
Normal file
8
Drab.Logic/Interfaces/IDbFetcher.cs
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Drab.Logic.Interfaces;
|
||||||
|
|
||||||
|
public interface IDbFetcher
|
||||||
|
{
|
||||||
|
Task Start();
|
||||||
|
}
|
||||||
12
Drab.Logic/Interfaces/ILocalOrderStore.cs
Normal file
12
Drab.Logic/Interfaces/ILocalOrderStore.cs
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
using Drab.LocalDb.Entities;
|
||||||
|
using Drab.Logic.Dtos;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Drab.Logic.Interfaces;
|
||||||
|
|
||||||
|
public interface ILocalOrderStore
|
||||||
|
{
|
||||||
|
public Task<List<OrderDb>> GetAll();
|
||||||
|
public Task<DokDto> GetOrderById(long dokId);
|
||||||
|
}
|
||||||
9
Drab.Logic/Interfaces/IOrderPdfGenerator.cs
Normal file
9
Drab.Logic/Interfaces/IOrderPdfGenerator.cs
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
using Drab.Logic.Dtos;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Drab.Logic.Interfaces;
|
||||||
|
|
||||||
|
public interface IOrderPdfGenerator
|
||||||
|
{
|
||||||
|
Task<string> GenerateOrder(DokDto order);
|
||||||
|
}
|
||||||
9
Drab.Logic/Interfaces/IOrderProcessor.cs
Normal file
9
Drab.Logic/Interfaces/IOrderProcessor.cs
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
using Drab.Logic.Dtos;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Drab.Logic.Interfaces;
|
||||||
|
|
||||||
|
public interface IOrderProcessor
|
||||||
|
{
|
||||||
|
Task ProcessOrder(DokDto order);
|
||||||
|
}
|
||||||
12
Drab.Logic/Interfaces/IOrderStore.cs
Normal file
12
Drab.Logic/Interfaces/IOrderStore.cs
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
using Drab.Core.Models;
|
||||||
|
using Drab.Logic.Dtos;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Drab.Logic.Interfaces;
|
||||||
|
|
||||||
|
public interface IOrdersStore : IDisposable
|
||||||
|
{
|
||||||
|
Task<Result<List<DokDto>, string>> FetchOrders();
|
||||||
|
}
|
||||||
9
Drab.Logic/Interfaces/IPrintService.cs
Normal file
9
Drab.Logic/Interfaces/IPrintService.cs
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
using Drab.Logic.Models;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Drab.Logic.Interfaces;
|
||||||
|
|
||||||
|
public interface IPrintService
|
||||||
|
{
|
||||||
|
Task<PrintDocumentResult> PrintPdf(PrintDocumentRequest request);
|
||||||
|
}
|
||||||
21
Drab.Logic/Ioc/IocLogicRegister.cs
Normal file
21
Drab.Logic/Ioc/IocLogicRegister.cs
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
using Drab.Logic.Interfaces;
|
||||||
|
using Drab.Logic.Services;
|
||||||
|
using Drab.Logic.Utils;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
|
||||||
|
namespace Drab.Logic.Ioc;
|
||||||
|
|
||||||
|
public static class IocLogicRegister
|
||||||
|
{
|
||||||
|
public static IServiceCollection AddDrabLogic(this IServiceCollection services)
|
||||||
|
{
|
||||||
|
services.AddSingleton<OrderEventBus>();
|
||||||
|
services.AddSingleton<IOrderProcessor, OrderProcessor>();
|
||||||
|
services.AddTransient<IPrintService, PrintService>();
|
||||||
|
services.AddTransient<IOrderPdfGenerator, OrderPdfGenerator>();
|
||||||
|
services.AddTransient<IOrdersStore, OrdersStore>();
|
||||||
|
services.AddHostedService<DbFetcher>();
|
||||||
|
services.AddTransient<ILocalOrderStore, LocalOrderStore>();
|
||||||
|
return services;
|
||||||
|
}
|
||||||
|
}
|
||||||
7
Drab.Logic/Models/PrintDocument.cs
Normal file
7
Drab.Logic/Models/PrintDocument.cs
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
using System.Drawing;
|
||||||
|
|
||||||
|
namespace Drab.Logic.Models;
|
||||||
|
|
||||||
|
public record PrintDocumentRequest(string FilePath, long DokId);
|
||||||
|
|
||||||
|
public record PrintDocumentResult(bool IsSuccess, string Message);
|
||||||
47
Drab.Logic/Services/LocalOrderStore.cs
Normal file
47
Drab.Logic/Services/LocalOrderStore.cs
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
using System;
|
||||||
|
using Drab.LocalDb;
|
||||||
|
using Drab.LocalDb.Entities;
|
||||||
|
using Drab.Logic.Dtos;
|
||||||
|
using Drab.Logic.Interfaces;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using NLog;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Drab.Logic.Services;
|
||||||
|
|
||||||
|
public class LocalOrderStore : ILocalOrderStore
|
||||||
|
{
|
||||||
|
|
||||||
|
private readonly ILogger _logger;
|
||||||
|
private readonly IServiceScopeFactory _serviceScopeFactory;
|
||||||
|
|
||||||
|
public LocalOrderStore(IServiceScopeFactory serviceScopeFactory)
|
||||||
|
{
|
||||||
|
_logger = LogManager.GetCurrentClassLogger();
|
||||||
|
_serviceScopeFactory = serviceScopeFactory;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<List<OrderDb>> GetAll()
|
||||||
|
{
|
||||||
|
using var scope = _serviceScopeFactory.CreateScope();
|
||||||
|
await using var dbContext = scope.ServiceProvider.GetService<LocalDbContext>();
|
||||||
|
var fromDate = DateTime.UtcNow.AddDays(-30);
|
||||||
|
|
||||||
|
var orders = dbContext.Orders
|
||||||
|
.Where(x => x.Created >= fromDate)
|
||||||
|
.OrderByDescending(x => x.Created)
|
||||||
|
.ToList();
|
||||||
|
return orders;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<DokDto> GetOrderById(long dokId)
|
||||||
|
{
|
||||||
|
using var scope = _serviceScopeFactory.CreateScope();
|
||||||
|
await using var dbContext = scope.ServiceProvider.GetService<LocalDbContext>();
|
||||||
|
var order = dbContext.Orders.FirstOrDefault(x => x.DokId == dokId);
|
||||||
|
|
||||||
|
return new DokDto();
|
||||||
|
}
|
||||||
|
}
|
||||||
58
Drab.Logic/Services/OldOrdersCleanupService.cs
Normal file
58
Drab.Logic/Services/OldOrdersCleanupService.cs
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
using System;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Drab.LocalDb;
|
||||||
|
using Microsoft.Extensions.Hosting;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
|
namespace Drab.Logic.Services;
|
||||||
|
|
||||||
|
public class OldOrdersCleanupService : BackgroundService
|
||||||
|
{
|
||||||
|
private readonly IServiceProvider _services;
|
||||||
|
private readonly ILogger<OldOrdersCleanupService> _logger;
|
||||||
|
private readonly TimeSpan _interval = TimeSpan.FromHours(24);
|
||||||
|
|
||||||
|
public OldOrdersCleanupService(IServiceProvider services, ILogger<OldOrdersCleanupService> logger)
|
||||||
|
{
|
||||||
|
_services = services;
|
||||||
|
_logger = logger;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
|
||||||
|
{
|
||||||
|
while (!stoppingToken.IsCancellationRequested)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using var scope = _services.CreateScope();
|
||||||
|
var dbContext = scope.ServiceProvider.GetRequiredService<LocalDbContext>();
|
||||||
|
|
||||||
|
var threshold = DateTime.Now.AddDays(-45);
|
||||||
|
var oldOrders = dbContext.Orders
|
||||||
|
.Where(o => o.Created < threshold)
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
if (oldOrders.Count != 0)
|
||||||
|
{
|
||||||
|
dbContext.Orders.RemoveRange(oldOrders);
|
||||||
|
await dbContext.SaveChangesAsync(stoppingToken);
|
||||||
|
|
||||||
|
_logger.LogInformation("Usunięto {OldOrdersCount} starych zamówień.", oldOrders.Count);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_logger.LogInformation("Nie znaleziono starych zamówień do usunięcia.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Błąd podczas usuwania starych zamówień.");
|
||||||
|
}
|
||||||
|
|
||||||
|
await Task.Delay(_interval, stoppingToken);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
13
Drab.Logic/Services/OrderEventBus.cs
Normal file
13
Drab.Logic/Services/OrderEventBus.cs
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace Drab.Logic.Services;
|
||||||
|
|
||||||
|
public class OrderEventBus
|
||||||
|
{
|
||||||
|
public event Action? OrdersChanged;
|
||||||
|
|
||||||
|
public void NotifyOrdersChanged()
|
||||||
|
{
|
||||||
|
OrdersChanged?.Invoke();
|
||||||
|
}
|
||||||
|
}
|
||||||
51
Drab.Logic/Services/OrderPdfGenerator.cs
Normal file
51
Drab.Logic/Services/OrderPdfGenerator.cs
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
using Drab.Logic.Dtos;
|
||||||
|
using Drab.Logic.Interfaces;
|
||||||
|
using FastReport;
|
||||||
|
using FastReport.Export.PdfSimple;
|
||||||
|
using NLog;
|
||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Drab.Logic.Services;
|
||||||
|
|
||||||
|
internal class OrderPdfGenerator : IOrderPdfGenerator
|
||||||
|
{
|
||||||
|
private readonly ILogger _logger;
|
||||||
|
|
||||||
|
public OrderPdfGenerator()
|
||||||
|
{
|
||||||
|
_logger = LogManager.GetCurrentClassLogger();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Task<string> GenerateOrder(DokDto order)
|
||||||
|
{
|
||||||
|
_logger.Info($"Generate pdf document: {order.NrDok}");
|
||||||
|
var cleanFilename = order.NrDok.Replace('/', '-');
|
||||||
|
var orderFilename = $"Zam_{cleanFilename}_{order.Data:yyyy-MM-dd}_{order.Sklep}_{order.DokId}.pdf";
|
||||||
|
var templatePath = Path.Combine(Constants.ReportsTemplatesPath, "Order.frx");
|
||||||
|
var outputFile = Path.Combine(Constants.ReportsOutputPath, orderFilename);
|
||||||
|
var version = Assembly.GetEntryAssembly().GetCustomAttribute<AssemblyInformationalVersionAttribute>().InformationalVersion;
|
||||||
|
var generatedAt = $"{DateTime.Now:yyyy-MM-dd HH:mm:ss}";
|
||||||
|
|
||||||
|
var data = new[] { order };
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var report = new Report();
|
||||||
|
report.Load(templatePath);
|
||||||
|
report.SetParameterValue("generatedAt", generatedAt);
|
||||||
|
report.SetParameterValue("version", version);
|
||||||
|
report.RegisterData(data, "Order");
|
||||||
|
report.Prepare();
|
||||||
|
var pdfExport = new PDFSimpleExport();
|
||||||
|
pdfExport.Export(report, outputFile);
|
||||||
|
return Task.FromResult(orderFilename);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
_logger.Error(e, "Error on generating order document: {OrderNo}", order.NrDok);
|
||||||
|
return Task.FromResult(string.Empty);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
154
Drab.Logic/Services/OrderProcessor.cs
Normal file
154
Drab.Logic/Services/OrderProcessor.cs
Normal file
@ -0,0 +1,154 @@
|
|||||||
|
using Drab.LocalDb;
|
||||||
|
using Drab.LocalDb.Entities;
|
||||||
|
using Drab.Logic.Dtos;
|
||||||
|
using Drab.Logic.Interfaces;
|
||||||
|
using Drab.Logic.Models;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using NLog;
|
||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Drab.Logic.Services;
|
||||||
|
|
||||||
|
public class OrderProcessor : IOrderProcessor
|
||||||
|
{
|
||||||
|
private readonly ILogger _logger;
|
||||||
|
private readonly IServiceScopeFactory _serviceScopeFactory;
|
||||||
|
private readonly IPrintService _printService;
|
||||||
|
private readonly IOrderPdfGenerator _orderPdfGenerator;
|
||||||
|
private readonly OrderEventBus _eventBus;
|
||||||
|
|
||||||
|
public OrderProcessor(IServiceScopeFactory serviceScopeFactory,
|
||||||
|
IPrintService printService,
|
||||||
|
IOrderPdfGenerator orderPdfGenerator,
|
||||||
|
OrderEventBus eventBus)
|
||||||
|
{
|
||||||
|
_logger = LogManager.GetCurrentClassLogger();
|
||||||
|
_serviceScopeFactory = serviceScopeFactory;
|
||||||
|
_printService = printService;
|
||||||
|
_orderPdfGenerator = orderPdfGenerator;
|
||||||
|
_eventBus = eventBus;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task ProcessOrder(DokDto order)
|
||||||
|
{
|
||||||
|
var dok = await GetOrCreateOrder(order);
|
||||||
|
|
||||||
|
if (dok.IsPrinted)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var filePath = await EnsureOrderPdfExists(order, dok);
|
||||||
|
|
||||||
|
var printResult = await PrintOrder(order, filePath);
|
||||||
|
|
||||||
|
if (printResult.IsSuccess)
|
||||||
|
{
|
||||||
|
dok.IsPrinted = true;
|
||||||
|
await SaveOrderIfChanged(dok);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task<OrderDb> GetOrCreateOrder(DokDto order)
|
||||||
|
{
|
||||||
|
var dok = await GetOrder(order.DokId);
|
||||||
|
|
||||||
|
if (dok != null)
|
||||||
|
return dok;
|
||||||
|
|
||||||
|
_logger.Info("Creating new order - {OrderNo}", order.NrDok);
|
||||||
|
|
||||||
|
dok = new OrderDb
|
||||||
|
{
|
||||||
|
DokId = order.DokId,
|
||||||
|
Created = order.Data,
|
||||||
|
OrderId = order.DokId,
|
||||||
|
Filename = string.Empty,
|
||||||
|
IsPrinted = false,
|
||||||
|
Shop = order.Sklep,
|
||||||
|
OrderNumber = order.NrDok
|
||||||
|
};
|
||||||
|
|
||||||
|
await SaveOrderIfChanged(dok);
|
||||||
|
return dok;
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task<string> EnsureOrderPdfExists(DokDto order, OrderDb dok)
|
||||||
|
{
|
||||||
|
if (!string.IsNullOrEmpty(dok.Filename))
|
||||||
|
{
|
||||||
|
var fullPath = Path.Combine(Constants.ReportsOutputPath, dok.Filename);
|
||||||
|
if (File.Exists(fullPath))
|
||||||
|
return fullPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
_logger.Info("Generating order file: {OrderNo}", order.NrDok);
|
||||||
|
|
||||||
|
var generatedFilename = await _orderPdfGenerator.GenerateOrder(order);
|
||||||
|
var newPath = Path.Combine(Constants.ReportsOutputPath, generatedFilename);
|
||||||
|
|
||||||
|
if (string.Equals(dok.Filename, generatedFilename, StringComparison.OrdinalIgnoreCase))
|
||||||
|
return newPath;
|
||||||
|
dok.Filename = generatedFilename;
|
||||||
|
await SaveOrderIfChanged(dok);
|
||||||
|
|
||||||
|
return newPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task<PrintDocumentResult> PrintOrder(DokDto order, string filePath)
|
||||||
|
{
|
||||||
|
_logger.Info("Printing order: {OrderNo}", order.NrDok);
|
||||||
|
|
||||||
|
var result = await _printService.PrintPdf(new PrintDocumentRequest(filePath, order.DokId));
|
||||||
|
|
||||||
|
_logger.Info("Printing result - OrderNo: {OrderNo}, Success: {IsSuccess}, Message: {Message}",
|
||||||
|
order.NrDok, result.IsSuccess, result.Message);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task<OrderDb?> GetOrder(long dokId)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using var scope = _serviceScopeFactory.CreateScope();
|
||||||
|
var context = scope.ServiceProvider.GetRequiredService<LocalDbContext>();
|
||||||
|
|
||||||
|
return await context.Orders
|
||||||
|
.FirstOrDefaultAsync(x => x.DokId == dokId);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
_logger.Error(e, "Error retrieving order from database");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task SaveOrderIfChanged(OrderDb order)
|
||||||
|
{
|
||||||
|
using var scope = _serviceScopeFactory.CreateScope();
|
||||||
|
var context = scope.ServiceProvider.GetRequiredService<LocalDbContext>();
|
||||||
|
|
||||||
|
var existing = await context.Orders.FirstOrDefaultAsync(x => x.DokId == order.DokId);
|
||||||
|
|
||||||
|
if (existing == null)
|
||||||
|
{
|
||||||
|
await context.Orders.AddAsync(order);
|
||||||
|
await context.SaveChangesAsync();
|
||||||
|
_eventBus.NotifyOrdersChanged();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (existing.IsPrinted == order.IsPrinted && existing.Filename == order.Filename)
|
||||||
|
return;
|
||||||
|
|
||||||
|
existing.IsPrinted = order.IsPrinted;
|
||||||
|
existing.Filename = order.Filename;
|
||||||
|
|
||||||
|
context.Orders.Update(existing);
|
||||||
|
await context.SaveChangesAsync();
|
||||||
|
|
||||||
|
_eventBus.NotifyOrdersChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
78
Drab.Logic/Services/OrdersStore.cs
Normal file
78
Drab.Logic/Services/OrdersStore.cs
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
using Drab.Core.Models;
|
||||||
|
using Drab.Logic.Dtos;
|
||||||
|
using Drab.Logic.Interfaces;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using NLog;
|
||||||
|
using Pcm.Db;
|
||||||
|
using Pcm.Db.Enums;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Globalization;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Drab.Core.Configuration;
|
||||||
|
|
||||||
|
namespace Drab.Logic.Services;
|
||||||
|
|
||||||
|
public class OrdersStore : IOrdersStore, IDisposable
|
||||||
|
{
|
||||||
|
private readonly ILogger _logger;
|
||||||
|
private readonly IServiceScopeFactory _serviceScopeFactory;
|
||||||
|
private readonly IDrabSettings _drabSettings;
|
||||||
|
|
||||||
|
public OrdersStore(IServiceScopeFactory serviceScopeFactory, IDrabSettings drabSettings)
|
||||||
|
{
|
||||||
|
_serviceScopeFactory = serviceScopeFactory;
|
||||||
|
_drabSettings = drabSettings;
|
||||||
|
_logger = LogManager.GetCurrentClassLogger();
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<Result<List<DokDto>, string>> FetchOrders()
|
||||||
|
{
|
||||||
|
_logger.Info("Fetch new orders");
|
||||||
|
|
||||||
|
DateTime date;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
date = DateTime.ParseExact(_drabSettings.IgnoreOrdersBefore, "yyyy-MM-dd", CultureInfo.InvariantCulture);
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
date = DateTime.Now - TimeSpan.FromDays(30);
|
||||||
|
}
|
||||||
|
|
||||||
|
using var scope = _serviceScopeFactory.CreateScope();
|
||||||
|
await using var dbContext = scope.ServiceProvider.GetService<PcmDbContext>();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var orders = await dbContext.Dokumenty
|
||||||
|
.Where(x => x.Aktywny == 1
|
||||||
|
&& x.TypDok == (short)TypDok.RejestracjaZamowieniaOdOdbiorcy
|
||||||
|
&& x.Opcja1 == 0
|
||||||
|
&& x.Data >= date)
|
||||||
|
.Include(x => x.DokKontr)
|
||||||
|
.ThenInclude(x => x.Kontr)
|
||||||
|
.Include(x => x.TekstDoks.Where(y =>
|
||||||
|
y.Znaczenie == (short)TekstDokZnaczenie.InfoDoZamowienia ||
|
||||||
|
y.Znaczenie == (short)TekstDokZnaczenie.TekstDod2))
|
||||||
|
.Include(x => x.PozDoks)
|
||||||
|
.ThenInclude(x => x.TekstPozs.Where(y => y.Znaczenie == 0 || y.Znaczenie == 13))
|
||||||
|
.Include(x => x.PozDoks)
|
||||||
|
.ThenInclude(x => x.Tow)
|
||||||
|
.ThenInclude(x => x.Jm)
|
||||||
|
.ToListAsync();
|
||||||
|
|
||||||
|
return Result.Ok<List<DokDto>, string>(orders.Select(x => x.ToDokDto()).ToList());
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
_logger.Error(e, "Error on fetching orders");
|
||||||
|
return Result.Failed<List<DokDto>, string>(e.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
71
Drab.Logic/Services/PrintService.cs
Normal file
71
Drab.Logic/Services/PrintService.cs
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
using Drab.Core.Configuration;
|
||||||
|
using Drab.Logic.Interfaces;
|
||||||
|
using Drab.Logic.Models;
|
||||||
|
using PdfiumViewer;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Drawing.Printing;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Printing;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Drab.Logic.Services;
|
||||||
|
|
||||||
|
public class PrintService : IPrintService
|
||||||
|
{
|
||||||
|
private readonly IDrabSettings _drabSettings;
|
||||||
|
|
||||||
|
public PrintService(IDrabSettings drabSettings)
|
||||||
|
{
|
||||||
|
_drabSettings = drabSettings;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<PrintDocumentResult> PrintPdf(PrintDocumentRequest request)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var oldJobs = GetPrintJobs(request.DokId.ToString());
|
||||||
|
if (oldJobs.Any(x => !x.IsRetained))
|
||||||
|
{
|
||||||
|
oldJobs.ForEach(x => x.Cancel());
|
||||||
|
await Task.Delay(TimeSpan.FromSeconds(2));
|
||||||
|
}
|
||||||
|
|
||||||
|
var (filePath, dokId) = request;
|
||||||
|
using (var document = PdfDocument.Load(filePath))
|
||||||
|
{
|
||||||
|
using (var printDocument = document.CreatePrintDocument())
|
||||||
|
{
|
||||||
|
var fileName = Path.GetFileName(filePath);
|
||||||
|
|
||||||
|
printDocument.PrinterSettings.PrintFileName = fileName;
|
||||||
|
printDocument.DocumentName = dokId.ToString();
|
||||||
|
printDocument.PrintController = new StandardPrintController();
|
||||||
|
printDocument.Print();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
await Task.Delay(TimeSpan.FromSeconds(_drabSettings.PrinterTimeoutSeconds));
|
||||||
|
|
||||||
|
var jobs = GetPrintJobs(request.DokId.ToString());
|
||||||
|
if (jobs.Count == 0)
|
||||||
|
return new PrintDocumentResult(true, "Print success.");
|
||||||
|
|
||||||
|
jobs.ForEach(x => x.Cancel());
|
||||||
|
return new PrintDocumentResult(false, "Print failed - timeout expired.");
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
return new PrintDocumentResult(false, $"Print failed - {e.Message}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static List<PrintSystemJobInfo> GetPrintJobs(string jobName)
|
||||||
|
{
|
||||||
|
var printQueue = LocalPrintServer.GetDefaultPrintQueue();
|
||||||
|
return printQueue.GetPrintJobInfoCollection()
|
||||||
|
.Where(x => x.Name == jobName)
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
Drab.Logic/System.Printing.dll
Normal file
BIN
Drab.Logic/System.Printing.dll
Normal file
Binary file not shown.
90
Drab.Logic/Templates/Order.frx
Normal file
90
Drab.Logic/Templates/Order.frx
Normal file
@ -0,0 +1,90 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Report ScriptLanguage="CSharp" ReportInfo.Name="Zamówienie" ReportInfo.Author="Piekarnia-Cukiernia BRZĘCZEK SP.K." ReportInfo.Version="1.0.0" ReportInfo.Created="06/20/2009 22:40:42" ReportInfo.Modified="07/11/2025 00:08:23" ReportInfo.CreatorVersion="2025.2.0.0">
|
||||||
|
<Styles>
|
||||||
|
<Style Name="Dark" Fill.Color="Gainsboro" Font="Arial, 10pt" ApplyBorder="false" ApplyTextFill="false" ApplyFont="false"/>
|
||||||
|
</Styles>
|
||||||
|
<Dictionary>
|
||||||
|
<BusinessObjectDataSource Name="Order" ReferenceName="Order" DataType="System.Int32" Enabled="true">
|
||||||
|
<Column Name="DokId" DataType="System.Int64"/>
|
||||||
|
<Column Name="NrDok" DataType="System.String"/>
|
||||||
|
<Column Name="Data" DataType="System.DateTime"/>
|
||||||
|
<Column Name="Opis" DataType="System.String"/>
|
||||||
|
<Column Name="Sklep" DataType="System.String"/>
|
||||||
|
<Column Name="CompanyInfo" DataType="System.Int32">
|
||||||
|
<Column Name="Name" DataType="System.String"/>
|
||||||
|
<Column Name="Nip" DataType="System.String"/>
|
||||||
|
<Column Name="Phone" DataType="System.String"/>
|
||||||
|
<Column Name="Email" DataType="System.String"/>
|
||||||
|
<Column Name="Address" DataType="System.Int32">
|
||||||
|
<Column Name="Street" DataType="System.String"/>
|
||||||
|
<Column Name="Number" DataType="System.Int32"/>
|
||||||
|
<Column Name="PostalCode" DataType="System.String"/>
|
||||||
|
<Column Name="City" DataType="System.String"/>
|
||||||
|
</Column>
|
||||||
|
</Column>
|
||||||
|
<BusinessObjectDataSource Name="PozDok" ReferenceName="PozDok" DataType="System.Int32" Enabled="true">
|
||||||
|
<Column Name="DokId" DataType="System.Int64"/>
|
||||||
|
<Column Name="Komentarz" DataType="System.String"/>
|
||||||
|
<Column Name="Ilosc" DataType="System.Decimal"/>
|
||||||
|
<Column Name="Towar" DataType="System.Int32">
|
||||||
|
<Column Name="TowId" DataType="System.Int64"/>
|
||||||
|
<Column Name="Nazwa" DataType="System.String"/>
|
||||||
|
<Column Name="Kod" DataType="System.String"/>
|
||||||
|
<Column Name="Jm" DataType="System.String"/>
|
||||||
|
</Column>
|
||||||
|
</BusinessObjectDataSource>
|
||||||
|
</BusinessObjectDataSource>
|
||||||
|
<Parameter Name="generatedAt" DataType="System.String" AsString=""/>
|
||||||
|
<Parameter Name="version" DataType="System.String" AsString=""/>
|
||||||
|
</Dictionary>
|
||||||
|
<ReportPage Name="Page1" RawPaperSize="9" Watermark.Font="Arial, 60pt" LastPageSource="15" FirstPageSource="15" OtherPageSource="15">
|
||||||
|
<PageHeaderBand Name="PageHeader1" Width="718.2" Height="85.05">
|
||||||
|
<TextObject Name="Text18" Width="718.2" Height="28.35" Text="[Order.NrDok]" HorzAlign="Center" Font="Arial, 14pt, style=Bold"/>
|
||||||
|
<TextObject Name="Text20" Top="37.8" Width="283.5" Height="28.35" Text="Data: [Order.Data] " VertAlign="Center" Font="Arial, 11pt, style=Bold"/>
|
||||||
|
<TextObject Name="Text19" Left="292.95" Top="37.8" Width="396.9" Height="28.35" Text="Sklep: [Order.Sklep]" HorzAlign="Right" VertAlign="Center" Font="Arial, 11pt, style=Bold"/>
|
||||||
|
</PageHeaderBand>
|
||||||
|
<DataBand Name="Data1" Top="86.65" Width="718.2" Height="28.35" DataSource="Order">
|
||||||
|
<TableObject Name="Table2" Width="717.95" Height="28.35">
|
||||||
|
<TableColumn Name="Column6" Width="51.96"/>
|
||||||
|
<TableColumn Name="Column7" Width="286.48"/>
|
||||||
|
<TableColumn Name="Column11" Width="114.91"/>
|
||||||
|
<TableColumn Name="Column10" Width="264.6"/>
|
||||||
|
<TableRow Name="Row2" Height="28.35">
|
||||||
|
<TableCell Name="Cell6" Border.Lines="All" Text="LP" VertAlign="Center" Font="Arial, 10pt, style=Bold"/>
|
||||||
|
<TableCell Name="Cell7" Border.Lines="All" Text="Towar" HorzAlign="Center" VertAlign="Center" Font="Arial, 10pt, style=Bold"/>
|
||||||
|
<TableCell Name="Cell10" Border.Lines="All" Text="Ilość" HorzAlign="Right" VertAlign="Center" Font="Arial, 10pt, style=Bold"/>
|
||||||
|
<TableCell Name="Cell11" Border.Lines="All" Text="Komentarz" HorzAlign="Center" VertAlign="Center" Font="Arial, 10pt, style=Bold"/>
|
||||||
|
</TableRow>
|
||||||
|
</TableObject>
|
||||||
|
<LineObject Name="Line2" Left="-9450" Top="-9450" Width="718.2" Diagonal="true"/>
|
||||||
|
<DataBand Name="Data2" Top="116.6" Width="718.2" Height="37.95" CanGrow="true" CanShrink="true" EvenStyle="Dark" CanBreak="true" DataSource="PozDok">
|
||||||
|
<TableObject Name="Table1" Width="717.76" Height="37.95">
|
||||||
|
<TableColumn Name="Column1" Width="51.79"/>
|
||||||
|
<TableColumn Name="Column2" Width="286.46"/>
|
||||||
|
<TableColumn Name="Column12" Width="114.91"/>
|
||||||
|
<TableColumn Name="Column5" Width="264.6"/>
|
||||||
|
<TableRow Name="Row1" Height="37.95" AutoSize="true">
|
||||||
|
<TableCell Name="Cell1" Text="[Row#]" VertAlign="Center" Font="Arial, 10pt"/>
|
||||||
|
<TableCell Name="Cell2" Text="[Order.PozDok.Towar.Nazwa]" VertAlign="Center" Font="Arial, 10pt"/>
|
||||||
|
<TableCell Name="Cell5" Text="[Order.PozDok.Ilosc] [Order.PozDok.Towar.Jm]" HorzAlign="Right" VertAlign="Center" Font="Arial, 10pt">
|
||||||
|
<Formats>
|
||||||
|
<NumberFormat/>
|
||||||
|
<GeneralFormat/>
|
||||||
|
</Formats>
|
||||||
|
</TableCell>
|
||||||
|
<TableCell Name="Cell12" CanBreak="false" Text="[Order.PozDok.Komentarz]" Font="Arial, 10pt"/>
|
||||||
|
</TableRow>
|
||||||
|
</TableObject>
|
||||||
|
</DataBand>
|
||||||
|
<DataFooterBand Name="DataFooter1" Top="156.15" Width="718.2" Height="85.05">
|
||||||
|
<TextObject Name="Text21" Top="9.45" Width="718.2" Height="75.6" Text="[Order.Opis]" Font="Arial, 10pt"/>
|
||||||
|
<LineObject Name="Line3" Width="718.2" Diagonal="true"/>
|
||||||
|
</DataFooterBand>
|
||||||
|
</DataBand>
|
||||||
|
<PageFooterBand Name="PageFooter1" Top="242.8" Width="718.2" Height="18.9">
|
||||||
|
<TextObject Name="Text6" Left="471" Width="245.7" Height="18.9" Text="Strona [Page#] z [TotalPages#]" HorzAlign="Right" VertAlign="Center" Font="Arial, 10pt"/>
|
||||||
|
<TextObject Name="Text7" Width="245.7" Height="18.9" Text="Wygenerowano: [generatedAt]" VertAlign="Center" Font="Arial, 10pt"/>
|
||||||
|
<TextObject Name="Text17" Left="245.7" Width="226.8" Height="18.9" Text="DRAB [version]" HorzAlign="Center" VertAlign="Center" Font="Arial, 10pt"/>
|
||||||
|
</PageFooterBand>
|
||||||
|
</ReportPage>
|
||||||
|
</Report>
|
||||||
62
Drab.Logic/Utils/DbFetcher.cs
Normal file
62
Drab.Logic/Utils/DbFetcher.cs
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
using Drab.Core.Configuration;
|
||||||
|
using Drab.Logic.Interfaces;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using NLog;
|
||||||
|
using System;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Microsoft.Extensions.Hosting;
|
||||||
|
|
||||||
|
namespace Drab.Logic.Utils;
|
||||||
|
|
||||||
|
public class DbFetcher : BackgroundService
|
||||||
|
{
|
||||||
|
private readonly IDrabSettings _drabSettings;
|
||||||
|
private readonly IServiceScopeFactory _serviceScopeFactory;
|
||||||
|
private readonly IOrderProcessor _orderProcessor;
|
||||||
|
private readonly ILogger _logger;
|
||||||
|
|
||||||
|
public DbFetcher(IDrabSettings drabSettings, IServiceScopeFactory serviceScopeFactory, IOrderProcessor orderProcessor)
|
||||||
|
{
|
||||||
|
_drabSettings = drabSettings;
|
||||||
|
_serviceScopeFactory = serviceScopeFactory;
|
||||||
|
_orderProcessor = orderProcessor;
|
||||||
|
_logger = LogManager.GetCurrentClassLogger();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override Task ExecuteAsync(CancellationToken stoppingToken)
|
||||||
|
{
|
||||||
|
Start();
|
||||||
|
return Task.CompletedTask;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task Start()
|
||||||
|
{
|
||||||
|
await Task.Delay(TimeSpan.FromSeconds(2));
|
||||||
|
while (true)
|
||||||
|
{
|
||||||
|
_logger.Info("Fetch database for new orders");
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using var scope = _serviceScopeFactory.CreateScope();
|
||||||
|
using var orderStore = scope.ServiceProvider.GetService<IOrdersStore>();
|
||||||
|
var result = await orderStore.FetchOrders();
|
||||||
|
|
||||||
|
if (result.IsNotOk)
|
||||||
|
_logger.Warn($"Fetch orders result failed: {result.Error}");
|
||||||
|
|
||||||
|
result.Value.ToList()
|
||||||
|
.ForEach(x => _orderProcessor.ProcessOrder(x));
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
_logger.Error(e, "Error on fetching new orders data:");
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
await Task.Delay(TimeSpan.FromSeconds(_drabSettings.DbPollingFrequencyInSeconds));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
49
Drab.sln
Normal file
49
Drab.sln
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
# Visual Studio Version 16
|
||||||
|
VisualStudioVersion = 16.0.31729.503
|
||||||
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Drab", "Drab\Drab.csproj", "{64D48CEF-6B5E-42CA-A6AB-10FCC15E1288}"
|
||||||
|
EndProject
|
||||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Pcm.Db", "Pcm.Db\Pcm.Db.csproj", "{3A449E77-3320-491D-805F-FB8DDFBD4FE2}"
|
||||||
|
EndProject
|
||||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Drab.Core", "Drab.Core\Drab.Core.csproj", "{FCA29186-6444-4532-AB25-E67446CAA060}"
|
||||||
|
EndProject
|
||||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Drab.Logic", "Drab.Logic\Drab.Logic.csproj", "{60CB71F2-798C-4E0E-B68F-9C29D8E2934A}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Drab.LocalDb", "Drab.LocalDb\Drab.LocalDb.csproj", "{FAFD1123-326B-40D6-A440-4CBBD783CA45}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
Release|Any CPU = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{64D48CEF-6B5E-42CA-A6AB-10FCC15E1288}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{64D48CEF-6B5E-42CA-A6AB-10FCC15E1288}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{64D48CEF-6B5E-42CA-A6AB-10FCC15E1288}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{64D48CEF-6B5E-42CA-A6AB-10FCC15E1288}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{3A449E77-3320-491D-805F-FB8DDFBD4FE2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{3A449E77-3320-491D-805F-FB8DDFBD4FE2}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{3A449E77-3320-491D-805F-FB8DDFBD4FE2}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{3A449E77-3320-491D-805F-FB8DDFBD4FE2}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{FCA29186-6444-4532-AB25-E67446CAA060}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{FCA29186-6444-4532-AB25-E67446CAA060}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{FCA29186-6444-4532-AB25-E67446CAA060}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{FCA29186-6444-4532-AB25-E67446CAA060}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{60CB71F2-798C-4E0E-B68F-9C29D8E2934A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{60CB71F2-798C-4E0E-B68F-9C29D8E2934A}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{60CB71F2-798C-4E0E-B68F-9C29D8E2934A}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{60CB71F2-798C-4E0E-B68F-9C29D8E2934A}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{FAFD1123-326B-40D6-A440-4CBBD783CA45}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{FAFD1123-326B-40D6-A440-4CBBD783CA45}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{FAFD1123-326B-40D6-A440-4CBBD783CA45}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{FAFD1123-326B-40D6-A440-4CBBD783CA45}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
|
SolutionGuid = {29279B5D-113E-4BB7-8E30-1E255A164BF2}
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
||||||
4
Drab.sln.DotSettings.user
Normal file
4
Drab.sln.DotSettings.user
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
|
||||||
|
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=3A449E77_002D3320_002D491D_002D805F_002DFB8DDFBD4FE2_002Ff_003APcmDbContext_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||||
|
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ACallSiteValidator_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FUsers_003Fpdude_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FSourcesCache_003F223f3993d7b717137d1eac7a1da6b5a458d1d124b0f8a62a3450f9bd6c89af_003FCallSiteValidator_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||||
|
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AServiceProvider_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FUsers_003Fpdude_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FSourcesCache_003Fce37be1a06b16c6faa02038d2cc477dd3bca5b217ceeb41c5f2ad45c1bf9_003FServiceProvider_002Ecs/@EntryIndexedValue">ForceIncluded</s:String></wpf:ResourceDictionary>
|
||||||
35
Drab/Drab.csproj
Normal file
35
Drab/Drab.csproj
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
||||||
|
<TargetFramework>net9.0-windows</TargetFramework>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<FrameworkReference Include="Microsoft.AspNetCore.App"/>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="9.0.7" />
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="9.0.7"/>
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="9.0.7"/>
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="9.0.7"/>
|
||||||
|
<PackageReference Include="NLog" Version="6.0.1"/>
|
||||||
|
<PackageReference Include="NLog.Web.AspNetCore" Version="6.0.1"/>
|
||||||
|
<PackageReference Include="Radzen.Blazor" Version="7.1.5" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\Drab.Core\Drab.Core.csproj"/>
|
||||||
|
<ProjectReference Include="..\Drab.Logic\Drab.Logic.csproj"/>
|
||||||
|
<ProjectReference Include="..\Pcm.Db\Pcm.Db.csproj"/>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Content Update="wwwroot\css\common.css">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
10
Drab/Drab.csproj.user
Normal file
10
Drab/Drab.csproj.user
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||||
|
<DebuggerFlavor>ProjectDebugger</DebuggerFlavor>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup>
|
||||||
|
<ActiveDebugProfile>Drab</ActiveDebugProfile>
|
||||||
|
<NameOfLastUsedPublishProfile>C:\__Repozytorium\DRAB\Drab\Properties\PublishProfiles\FolderProfile.pubxml</NameOfLastUsedPublishProfile>
|
||||||
|
</PropertyGroup>
|
||||||
|
</Project>
|
||||||
18
Drab/FileController.cs
Normal file
18
Drab/FileController.cs
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
|
namespace Drab;
|
||||||
|
|
||||||
|
[ApiController]
|
||||||
|
public class FileController : ControllerBase
|
||||||
|
{
|
||||||
|
[HttpGet("/pdf/{filename}")]
|
||||||
|
public IActionResult Get([FromRoute] string filename)
|
||||||
|
{
|
||||||
|
var filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Orders", filename);
|
||||||
|
|
||||||
|
if (!System.IO.File.Exists(filePath))
|
||||||
|
return NotFound();
|
||||||
|
|
||||||
|
return File(System.IO.File.OpenRead(filePath), "application/pdf");
|
||||||
|
}
|
||||||
|
}
|
||||||
79
Drab/Program.cs
Normal file
79
Drab/Program.cs
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
using System.Net;
|
||||||
|
using Drab.Core.Configuration;
|
||||||
|
using Drab.Core.Ioc;
|
||||||
|
using Drab.LocalDb;
|
||||||
|
using Drab.LocalDb.IoC;
|
||||||
|
using Drab.Logic.Ioc;
|
||||||
|
using Drab.Logic.Services;
|
||||||
|
using Drab.Ui;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using NLog.Extensions.Logging;
|
||||||
|
using Pcm.Db.Ioc;
|
||||||
|
using Radzen;
|
||||||
|
|
||||||
|
var builder = WebApplication.CreateBuilder(args);
|
||||||
|
|
||||||
|
var configurationBuilder = new ConfigurationBuilder()
|
||||||
|
.SetBasePath(AppDomain.CurrentDomain.BaseDirectory)
|
||||||
|
.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true);
|
||||||
|
var configuration = configurationBuilder.Build();
|
||||||
|
|
||||||
|
var port = int.Parse(builder.WebHost.GetSetting("ListenPort") ?? "5010");
|
||||||
|
|
||||||
|
builder.Services.AddRazorComponents()
|
||||||
|
.AddInteractiveServerComponents();
|
||||||
|
|
||||||
|
builder.Services.AddLogging(loggingBuilder =>
|
||||||
|
{
|
||||||
|
loggingBuilder.ClearProviders();
|
||||||
|
loggingBuilder.AddConfiguration(configuration.GetSection("Logging"));
|
||||||
|
loggingBuilder.AddNLog("nlog.config");
|
||||||
|
});
|
||||||
|
|
||||||
|
var drabSettings = configuration.GetSection(DrabSettings.SectionName).Get<DrabSettings>();
|
||||||
|
var localDbSettings = configuration.GetSection(LocalDbConfiguration.SectionName).Get<LocalDbConfiguration>();
|
||||||
|
builder.Services.AddLocalDatabase(localDbSettings);
|
||||||
|
var dbConfig = configuration.GetSection(PcmDbConfiguration.SectionName).Get<PcmDbConfiguration>();
|
||||||
|
|
||||||
|
builder.Services.AddPcmDatabase(dbConfig);
|
||||||
|
builder.Services.AddDrabCore(drabSettings);
|
||||||
|
builder.Services.AddDrabLogic();
|
||||||
|
builder.Services.AddHostedService<OldOrdersCleanupService>();
|
||||||
|
|
||||||
|
builder.Services.AddRadzenComponents();
|
||||||
|
builder.Services.AddControllers().AddControllersAsServices();
|
||||||
|
builder.WebHost
|
||||||
|
.UseKestrel(options =>
|
||||||
|
{
|
||||||
|
options.Listen(IPAddress.Any, port);
|
||||||
|
})
|
||||||
|
.UseContentRoot(Directory.GetCurrentDirectory());
|
||||||
|
|
||||||
|
var app = builder.Build();
|
||||||
|
|
||||||
|
if (!app.Environment.IsDevelopment())
|
||||||
|
{
|
||||||
|
app.UseExceptionHandler("/Error", createScopeForErrors: true);
|
||||||
|
app.UseHsts();
|
||||||
|
}
|
||||||
|
|
||||||
|
app.UseStaticFiles();
|
||||||
|
app.UseRouting();
|
||||||
|
app.UseAntiforgery();
|
||||||
|
app.MapControllers();
|
||||||
|
app.MapRazorComponents<App>()
|
||||||
|
.AddInteractiveServerRenderMode();
|
||||||
|
|
||||||
|
if (!Directory.Exists(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Orders")))
|
||||||
|
{
|
||||||
|
Directory.CreateDirectory(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Orders"));
|
||||||
|
}
|
||||||
|
|
||||||
|
var scope = app.Services.GetService<IServiceScopeFactory>();
|
||||||
|
using (var scopeProvider = scope.CreateScope())
|
||||||
|
{
|
||||||
|
await using var context = scopeProvider.ServiceProvider.GetRequiredService<LocalDbContext>();
|
||||||
|
await context.Database.MigrateAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
app.Run();
|
||||||
24
Drab/Properties/PublishProfiles/FolderProfile.pubxml
Normal file
24
Drab/Properties/PublishProfiles/FolderProfile.pubxml
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||||
|
-->
|
||||||
|
<Project>
|
||||||
|
<PropertyGroup>
|
||||||
|
<DeleteExistingFiles>true</DeleteExistingFiles>
|
||||||
|
<ExcludeApp_Data>false</ExcludeApp_Data>
|
||||||
|
<LaunchSiteAfterPublish>true</LaunchSiteAfterPublish>
|
||||||
|
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
|
||||||
|
<LastUsedPlatform>Any CPU</LastUsedPlatform>
|
||||||
|
<PublishProvider>FileSystem</PublishProvider>
|
||||||
|
<PublishUrl>bin\Release\publish\</PublishUrl>
|
||||||
|
<WebPublishMethod>FileSystem</WebPublishMethod>
|
||||||
|
<_TargetId>Folder</_TargetId>
|
||||||
|
<SiteUrlToLaunchAfterPublish />
|
||||||
|
<TargetFramework>net6.0-windows</TargetFramework>
|
||||||
|
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
||||||
|
<PublishSingleFile>false</PublishSingleFile>
|
||||||
|
<PublishReadyToRun>true</PublishReadyToRun>
|
||||||
|
<ProjectGuid>64d48cef-6b5e-42ca-a6ab-10fcc15e1288</ProjectGuid>
|
||||||
|
<SelfContained>true</SelfContained>
|
||||||
|
</PropertyGroup>
|
||||||
|
</Project>
|
||||||
11
Drab/Properties/PublishProfiles/FolderProfile.pubxml.user
Normal file
11
Drab/Properties/PublishProfiles/FolderProfile.pubxml.user
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||||
|
-->
|
||||||
|
<Project>
|
||||||
|
<PropertyGroup>
|
||||||
|
<_PublishTargetUrl>C:\__Repozytorium\DRAB\Drab\bin\Release\publish\</_PublishTargetUrl>
|
||||||
|
<History>True|2023-02-21T14:54:18.7590581Z;True|2023-02-18T14:13:57.9596803+01:00;False|2023-02-18T14:12:47.7973484+01:00;False|2023-02-18T14:11:56.4748109+01:00;</History>
|
||||||
|
<LastFailureDetails />
|
||||||
|
</PropertyGroup>
|
||||||
|
</Project>
|
||||||
28
Drab/Properties/launchSettings.json
Normal file
28
Drab/Properties/launchSettings.json
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
{
|
||||||
|
"iisSettings": {
|
||||||
|
"windowsAuthentication": false,
|
||||||
|
"anonymousAuthentication": true,
|
||||||
|
"iisExpress": {
|
||||||
|
"applicationUrl": "http://localhost:26177",
|
||||||
|
"sslPort": 44338
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"profiles": {
|
||||||
|
"IIS Express": {
|
||||||
|
"commandName": "IISExpress",
|
||||||
|
"launchBrowser": true,
|
||||||
|
"environmentVariables": {
|
||||||
|
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Drab": {
|
||||||
|
"commandName": "Project",
|
||||||
|
"dotnetRunMessages": "true",
|
||||||
|
"launchBrowser": false,
|
||||||
|
"applicationUrl": "http://localhost:5000",
|
||||||
|
"environmentVariables": {
|
||||||
|
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
25
Drab/Ui/App.razor
Normal file
25
Drab/Ui/App.razor
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
@using Drab.Ui.components
|
||||||
|
@using Microsoft.AspNetCore.Components.Web
|
||||||
|
@using Radzen
|
||||||
|
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8"/>
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
||||||
|
<base href="/"/>
|
||||||
|
<RadzenTheme Theme="standard" @rendermode="RenderMode.InteractiveServer"/>
|
||||||
|
<link rel="stylesheet" href="/css/common.css"/>
|
||||||
|
<ImportMap/>
|
||||||
|
<title>Brzęczek - Zamówienia</title>
|
||||||
|
<HeadOutlet/>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<Routes @rendermode="RenderMode.InteractiveServer"/>
|
||||||
|
<script src="_content/Radzen.Blazor/Radzen.Blazor.js?v=@(typeof(Colors).Assembly.GetName().Version)"></script>
|
||||||
|
<script src="_framework/blazor.web.js"></script>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
||||||
109
Drab/Ui/Pages/Index.razor
Normal file
109
Drab/Ui/Pages/Index.razor
Normal file
@ -0,0 +1,109 @@
|
|||||||
|
@page "/"
|
||||||
|
@using Drab.LocalDb
|
||||||
|
@using Drab.LocalDb.Entities
|
||||||
|
@using Drab.Logic.Services
|
||||||
|
@using Drab.Ui.components
|
||||||
|
@using Radzen
|
||||||
|
@inject LocalDbContext LocalDbContext
|
||||||
|
@inject DialogService DialogService
|
||||||
|
@inject OrderEventBus EventBus
|
||||||
|
|
||||||
|
@implements IDisposable
|
||||||
|
|
||||||
|
<RadzenDataGrid Data="@_orders"
|
||||||
|
TItem="OrderDb"
|
||||||
|
@ref="_dataGridRef"
|
||||||
|
AllowFiltering="true"
|
||||||
|
AllowColumnResize="false"
|
||||||
|
AllowAlternatingRows="false"
|
||||||
|
AllowColumnReorder="false"
|
||||||
|
Density="Density.Default"
|
||||||
|
FilterCaseSensitivity="FilterCaseSensitivity.CaseInsensitive"
|
||||||
|
AllowSorting="true"
|
||||||
|
PageSize="20"
|
||||||
|
AllowPaging="true"
|
||||||
|
GridLines="DataGridGridLines.Both"
|
||||||
|
PagerHorizontalAlign="HorizontalAlign.Center"
|
||||||
|
ShowPagingSummary="true"
|
||||||
|
LogicalFilterOperator="LogicalFilterOperator.Or"
|
||||||
|
SelectionMode="DataGridSelectionMode.Single"
|
||||||
|
RowClick="@(RowClick)">
|
||||||
|
<Columns>
|
||||||
|
<RadzenDataGridColumn Property="@nameof(OrderDb.Shop)"
|
||||||
|
Filterable="true"
|
||||||
|
Title="Sklep"
|
||||||
|
Width="200px"
|
||||||
|
FilterMode="FilterMode.CheckBoxList"/>
|
||||||
|
<RadzenDataGridColumn Property="@nameof(OrderDb.Created)"
|
||||||
|
Title="Data"
|
||||||
|
Filterable="false"
|
||||||
|
SortOrder="SortOrder.Descending"
|
||||||
|
TextAlign="TextAlign.Center"
|
||||||
|
Width="160px"/>
|
||||||
|
<RadzenDataGridColumn Property="@nameof(OrderDb.IsPrinted)"
|
||||||
|
Title="Wydrukowane"
|
||||||
|
FilterMode="FilterMode.CheckBoxList"
|
||||||
|
TextAlign="TextAlign.Center"
|
||||||
|
Width="100px">
|
||||||
|
<Template Context="order">
|
||||||
|
@if (order.IsPrinted)
|
||||||
|
{
|
||||||
|
<RadzenIcon IconStyle="IconStyle.Success" Icon="check_circle"/>
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<RadzenIcon IconStyle="IconStyle.Danger" Icon="highlight_off"/>
|
||||||
|
}
|
||||||
|
</Template>
|
||||||
|
</RadzenDataGridColumn>
|
||||||
|
<RadzenDataGridColumn Property="@nameof(OrderDb.OrderNumber)"
|
||||||
|
FilterMode="FilterMode.CheckBoxList"
|
||||||
|
Title="Numer"
|
||||||
|
Width="150px"/>
|
||||||
|
</Columns>
|
||||||
|
</RadzenDataGrid>
|
||||||
|
|
||||||
|
@code {
|
||||||
|
IQueryable<OrderDb> _orders;
|
||||||
|
private RadzenDataGrid<OrderDb>? _dataGridRef;
|
||||||
|
|
||||||
|
protected override void OnInitialized()
|
||||||
|
{
|
||||||
|
EventBus.OrdersChanged += OnOrdersChanged;
|
||||||
|
_orders = LocalDbContext.Orders;
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task RowClick(DataGridRowMouseEventArgs<OrderDb> obj)
|
||||||
|
{
|
||||||
|
await DialogService.OpenAsync<PdfViewer>($"Zamówienie {obj.Data.OrderNumber} - Sklep {obj.Data.Shop}",
|
||||||
|
new Dictionary<string, object>() {{nameof(PdfViewer.Filename), obj.Data.Filename}},
|
||||||
|
new DialogOptions()
|
||||||
|
{
|
||||||
|
CloseDialogOnEsc = true,
|
||||||
|
CloseDialogOnOverlayClick = true,
|
||||||
|
Resizable = false,
|
||||||
|
Draggable = false,
|
||||||
|
Width = "80%",
|
||||||
|
Height = "90vh"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnOrdersChanged()
|
||||||
|
{
|
||||||
|
InvokeAsync(() =>
|
||||||
|
{
|
||||||
|
_orders = LocalDbContext.Orders;
|
||||||
|
_dataGridRef?.Reload();
|
||||||
|
StateHasChanged();
|
||||||
|
return Task.CompletedTask;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
EventBus.OrdersChanged -= OnOrdersChanged;
|
||||||
|
LocalDbContext?.Dispose();
|
||||||
|
DialogService?.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
1
Drab/Ui/_Imports.razor
Normal file
1
Drab/Ui/_Imports.razor
Normal file
@ -0,0 +1 @@
|
|||||||
|
@using Radzen.Blazor
|
||||||
18
Drab/Ui/components/MainLayout.razor
Normal file
18
Drab/Ui/components/MainLayout.razor
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
@inherits LayoutComponentBase
|
||||||
|
|
||||||
|
<RadzenLayout>
|
||||||
|
<RadzenBody>
|
||||||
|
<div class="rz-p-0" style="margin: auto; width: 100%; max-width: 1900px !important;">
|
||||||
|
@Body
|
||||||
|
</div>
|
||||||
|
</RadzenBody>
|
||||||
|
</RadzenLayout>
|
||||||
|
<div id="blazor-error-ui" data-nosnippet>
|
||||||
|
An unhandled error has occurred.
|
||||||
|
<a href="." class="reload">Reload</a>
|
||||||
|
<span class="dismiss">🗙</span>
|
||||||
|
</div>
|
||||||
|
<RadzenDialog/>
|
||||||
|
<RadzenNotification/>
|
||||||
|
<RadzenTooltip/>
|
||||||
|
<RadzenContextMenu/>
|
||||||
9
Drab/Ui/components/PdfViewer.razor
Normal file
9
Drab/Ui/components/PdfViewer.razor
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<object data="@($"/pdf/{Filename}")"
|
||||||
|
style="width: 100%; height: 80vh; border: 1px solid gray"
|
||||||
|
type="application/pdf" width="100%" height="500px">
|
||||||
|
</object>
|
||||||
|
|
||||||
|
@code {
|
||||||
|
[Parameter]
|
||||||
|
public string Filename { get; set; } = string.Empty;
|
||||||
|
}
|
||||||
12
Drab/Ui/components/Routes.razor
Normal file
12
Drab/Ui/components/Routes.razor
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
@using Microsoft.AspNetCore.Components.Routing
|
||||||
|
|
||||||
|
<Router AppAssembly="@typeof(App).Assembly">
|
||||||
|
<Found Context="routeData">
|
||||||
|
<RouteView RouteData="routeData" DefaultLayout="@typeof(MainLayout)"/>
|
||||||
|
</Found>
|
||||||
|
<NotFound>
|
||||||
|
<LayoutView Layout="@typeof(MainLayout)">
|
||||||
|
<p>404 – nie znaleziono strony</p>
|
||||||
|
</LayoutView>
|
||||||
|
</NotFound>
|
||||||
|
</Router>
|
||||||
1
Drab/add migration.txt
Normal file
1
Drab/add migration.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
dotnet ef migrations add Initial --project ..\Drab.LocalDb\Drab.LocalDb.csproj --context LocalDbContext
|
||||||
10
Drab/appsettings.Development.json
Normal file
10
Drab/appsettings.Development.json
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"DetailedErrors": true,
|
||||||
|
"Logging": {
|
||||||
|
"LogLevel": {
|
||||||
|
"Default": "Information",
|
||||||
|
"Microsoft": "Warning",
|
||||||
|
"Microsoft.Hosting.Lifetime": "Information"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
26
Drab/appsettings.json
Normal file
26
Drab/appsettings.json
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
{
|
||||||
|
"Logging": {
|
||||||
|
"LogLevel": {
|
||||||
|
"Default": "Information",
|
||||||
|
"Microsoft": "Warning",
|
||||||
|
"Microsoft.Hosting.Lifetime": "Information"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"ListenPort": 80,
|
||||||
|
"AllowedHosts": "*",
|
||||||
|
"DrabSettings": {
|
||||||
|
"DbPollingFrequencyInSeconds": 180,
|
||||||
|
"PrinterTimeoutSeconds": 30,
|
||||||
|
"IgnoreOrdersBefore": "2025-07-11"
|
||||||
|
},
|
||||||
|
"PcmDbSettings": {
|
||||||
|
"Host": "192.168.200.6",
|
||||||
|
"Port": "1433",
|
||||||
|
"User": "sa",
|
||||||
|
"Password": "10Coma123",
|
||||||
|
"Database": "BRZECZEK"
|
||||||
|
},
|
||||||
|
"LocalDbConnection": {
|
||||||
|
"ConnectionString": "Data Source=.\\drab.db"
|
||||||
|
}
|
||||||
|
}
|
||||||
33
Drab/nlog.config
Normal file
33
Drab/nlog.config
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
autoReload="true"
|
||||||
|
throwExceptions="false">
|
||||||
|
|
||||||
|
<extensions>
|
||||||
|
<add assembly="NLog.Web.AspNetCore"/>
|
||||||
|
</extensions>
|
||||||
|
|
||||||
|
<variable name="logDirectory" value="${basedir}/logs"/>
|
||||||
|
<variable name="maxLogFiles" value="60"/>
|
||||||
|
|
||||||
|
<targets>
|
||||||
|
<default-wrapper xsi:type="AsyncWrapper" overflowAction="Block" timeToSleepBetweenBatches="0"/>
|
||||||
|
<target name="File"
|
||||||
|
xsi:type="File"
|
||||||
|
fileName="${logDirectory}/${shortdate}.log"
|
||||||
|
encoding="UTF-8"
|
||||||
|
keepFileOpen="True"
|
||||||
|
maxArchiveFiles="${maxLogFiles}"
|
||||||
|
layout="${date:format=yyyy-MM-dd HH\:mm\:ss.ffffK} | ${level:uppercase=true} | ${logger:uppercase=true} | ${message}${onexception:${newline}${exception:format=ToString,StackTrace:maxInnerFaultLevel=5:innerFormat=ToString,StackTrace}}"/>
|
||||||
|
<target name="Console" xsi:type="ColoredConsole"
|
||||||
|
layout="${date:format=yyyy-MM-dd HH\:mm\:ss.ffffK} | ${level:uppercase=true} | ${logger:uppercase=true} | ${message}${onexception:${newline}${exception:format=ToString,StackTrace:maxInnerFaultLevel=5:innerFormat=ToString,StackTrace}}"/>
|
||||||
|
</targets>
|
||||||
|
|
||||||
|
<rules>
|
||||||
|
<logger name="Microsoft.Hosting.Lifetime" minlevel="Info" writeTo="File, Console" final="true"/>
|
||||||
|
<logger name="Microsoft.*" maxlevel="Info" final="true"/>
|
||||||
|
<logger name="System.Net.Http.*" maxlevel="Info" final="true"/>
|
||||||
|
<logger name="*" minlevel="Debug" writeTo="File, Console"/>
|
||||||
|
</rules>
|
||||||
|
</nlog>
|
||||||
37
Drab/wwwroot/css/common.css
Normal file
37
Drab/wwwroot/css/common.css
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
html, body {
|
||||||
|
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
|
||||||
|
background-image: none !important;
|
||||||
|
width: 100% !important;
|
||||||
|
margin: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.blazor-error-boundary {
|
||||||
|
background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
|
||||||
|
padding: 1rem 1rem 1rem 3.7rem;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.blazor-error-boundary::after {
|
||||||
|
content: "An error has occurred."
|
||||||
|
}
|
||||||
|
|
||||||
|
#blazor-error-ui {
|
||||||
|
color-scheme: light only;
|
||||||
|
background: lightyellow;
|
||||||
|
bottom: 0;
|
||||||
|
box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
|
||||||
|
box-sizing: border-box;
|
||||||
|
display: none;
|
||||||
|
left: 0;
|
||||||
|
padding: 0.6rem 1.25rem 0.7rem 1.25rem;
|
||||||
|
position: fixed;
|
||||||
|
width: 100%;
|
||||||
|
z-index: 1000;
|
||||||
|
}
|
||||||
|
|
||||||
|
#blazor-error-ui .dismiss {
|
||||||
|
cursor: pointer;
|
||||||
|
position: absolute;
|
||||||
|
right: 0.75rem;
|
||||||
|
top: 0.5rem;
|
||||||
|
}
|
||||||
20
Pcm.Db/Entities/Akwizytor.cs
Normal file
20
Pcm.Db/Entities/Akwizytor.cs
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Pcm.Db.Entities;
|
||||||
|
|
||||||
|
public class Akwizytor
|
||||||
|
{
|
||||||
|
public Akwizytor()
|
||||||
|
{
|
||||||
|
Kontrahents = new HashSet<Kontrahent>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public decimal AkwId { get; set; }
|
||||||
|
public string Nazwisko { get; set; }
|
||||||
|
public string Opis { get; set; }
|
||||||
|
public decimal Prowizja { get; set; }
|
||||||
|
|
||||||
|
public virtual ICollection<Kontrahent> Kontrahents { get; set; }
|
||||||
|
}
|
||||||
21
Pcm.Db/Entities/Artykul.cs
Normal file
21
Pcm.Db/Entities/Artykul.cs
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Pcm.Db.Entities;
|
||||||
|
|
||||||
|
public class Artykul
|
||||||
|
{
|
||||||
|
public Artykul()
|
||||||
|
{
|
||||||
|
Towars = new HashSet<Towar>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public decimal ArtId { get; set; }
|
||||||
|
public string ArtNazwa { get; set; }
|
||||||
|
public decimal? CentrArtId { get; set; }
|
||||||
|
public decimal? GlownyTowId { get; set; }
|
||||||
|
|
||||||
|
public virtual Towar GlownyTow { get; set; }
|
||||||
|
public virtual ICollection<Towar> Towars { get; set; }
|
||||||
|
}
|
||||||
43
Pcm.Db/Entities/Asort.cs
Normal file
43
Pcm.Db/Entities/Asort.cs
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Pcm.Db.Entities;
|
||||||
|
|
||||||
|
public class Asort
|
||||||
|
{
|
||||||
|
public Asort()
|
||||||
|
{
|
||||||
|
Marzowniks = new HashSet<Marzownik>();
|
||||||
|
Przydzials = new HashSet<Przydzial>();
|
||||||
|
RegulaAsorts = new HashSet<RegulaAsort>();
|
||||||
|
SklepPrzydzials = new HashSet<SklepPrzydzial>();
|
||||||
|
Towars = new HashSet<Towar>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public decimal AsId { get; set; }
|
||||||
|
public string Nazwa { get; set; }
|
||||||
|
public decimal Marza { get; set; }
|
||||||
|
public short OpcjaMarzy { get; set; }
|
||||||
|
public decimal HurtRabat { get; set; }
|
||||||
|
public short OpcjaRabatu { get; set; }
|
||||||
|
public decimal NocNarzut { get; set; }
|
||||||
|
public short OpcjaNarzutu { get; set; }
|
||||||
|
public decimal? CentrAsId { get; set; }
|
||||||
|
public short? UkrytyNaPanelach { get; set; }
|
||||||
|
public short? UkrytyNaBonowniku { get; set; }
|
||||||
|
public short? BezAutoEtykiet { get; set; }
|
||||||
|
public decimal? Param1 { get; set; }
|
||||||
|
|
||||||
|
[JsonIgnore]
|
||||||
|
public virtual ICollection<Marzownik> Marzowniks { get; set; }
|
||||||
|
[JsonIgnore]
|
||||||
|
public virtual ICollection<Przydzial> Przydzials { get; set; }
|
||||||
|
[JsonIgnore]
|
||||||
|
public virtual ICollection<RegulaAsort> RegulaAsorts { get; set; }
|
||||||
|
[JsonIgnore]
|
||||||
|
public virtual ICollection<SklepPrzydzial> SklepPrzydzials { get; set; }
|
||||||
|
[JsonIgnore]
|
||||||
|
public virtual ICollection<Towar> Towars { get; set; }
|
||||||
|
}
|
||||||
26
Pcm.Db/Entities/Bank.cs
Normal file
26
Pcm.Db/Entities/Bank.cs
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Pcm.Db.Entities;
|
||||||
|
|
||||||
|
public class Bank
|
||||||
|
{
|
||||||
|
public Bank()
|
||||||
|
{
|
||||||
|
KontoBankoweKontrs = new HashSet<KontoBankoweKontr>();
|
||||||
|
KontoBankowes = new HashSet<KontoBankowe>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public decimal BankId { get; set; }
|
||||||
|
public string Nazwa { get; set; }
|
||||||
|
public string Adres { get; set; }
|
||||||
|
public short Aktywny { get; set; }
|
||||||
|
public DateTime Zmiana { get; set; }
|
||||||
|
public decimal? CentrBankId { get; set; }
|
||||||
|
public string NrRozliBank { get; set; }
|
||||||
|
|
||||||
|
public virtual ICollection<KontoBankoweKontr> KontoBankoweKontrs { get; set; }
|
||||||
|
public virtual ICollection<KontoBankowe> KontoBankowes { get; set; }
|
||||||
|
}
|
||||||
14
Pcm.Db/Entities/Blokadum.cs
Normal file
14
Pcm.Db/Entities/Blokadum.cs
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Pcm.Db.Entities;
|
||||||
|
|
||||||
|
public class Blokadum
|
||||||
|
{
|
||||||
|
public decimal SesjaId { get; set; }
|
||||||
|
public decimal TowId { get; set; }
|
||||||
|
public decimal MagId { get; set; }
|
||||||
|
public decimal Ilosc { get; set; }
|
||||||
|
|
||||||
|
public virtual Istw Istw { get; set; }
|
||||||
|
public virtual SesjaAktywna Sesja { get; set; }
|
||||||
|
}
|
||||||
19
Pcm.Db/Entities/CentrStanZgody.cs
Normal file
19
Pcm.Db/Entities/CentrStanZgody.cs
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Pcm.Db.Entities;
|
||||||
|
|
||||||
|
public class CentrStanZgody
|
||||||
|
{
|
||||||
|
public decimal KontrId { get; set; }
|
||||||
|
public decimal ZgId { get; set; }
|
||||||
|
public short Status { get; set; }
|
||||||
|
public string Kiedy { get; set; }
|
||||||
|
public string Wersja { get; set; }
|
||||||
|
public short? FormaDec { get; set; }
|
||||||
|
public DateTime? DataDec { get; set; }
|
||||||
|
|
||||||
|
public virtual Kontrahent Kontr { get; set; }
|
||||||
|
public virtual Zgodum Zg { get; set; }
|
||||||
|
}
|
||||||
20
Pcm.Db/Entities/Cza.cs
Normal file
20
Pcm.Db/Entities/Cza.cs
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Pcm.Db.Entities;
|
||||||
|
|
||||||
|
public class Cza
|
||||||
|
{
|
||||||
|
public decimal CzasId { get; set; }
|
||||||
|
public decimal? DzienTygodnia { get; set; }
|
||||||
|
public decimal? DzienMiesiaca { get; set; }
|
||||||
|
public decimal? Dzien { get; set; }
|
||||||
|
public decimal? TydzienRoku { get; set; }
|
||||||
|
public decimal? Tydzien { get; set; }
|
||||||
|
public decimal? MiesiacRoku { get; set; }
|
||||||
|
public decimal? Miesiac { get; set; }
|
||||||
|
public decimal? Weekend { get; set; }
|
||||||
|
public decimal? Rok { get; set; }
|
||||||
|
public DateTime? Data { get; set; }
|
||||||
|
}
|
||||||
25
Pcm.Db/Entities/DefinicjaKodu.cs
Normal file
25
Pcm.Db/Entities/DefinicjaKodu.cs
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Pcm.Db.Entities;
|
||||||
|
|
||||||
|
public class DefinicjaKodu
|
||||||
|
{
|
||||||
|
public DefinicjaKodu()
|
||||||
|
{
|
||||||
|
SkladnikDefinicjiKodus = new HashSet<SkladnikDefinicjiKodu>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public decimal Dkid { get; set; }
|
||||||
|
public short Typ { get; set; }
|
||||||
|
public string Nazwa { get; set; }
|
||||||
|
public DateTime? DataOd { get; set; }
|
||||||
|
public DateTime? DataDo { get; set; }
|
||||||
|
public short Aktywny { get; set; }
|
||||||
|
public DateTime Zmiana { get; set; }
|
||||||
|
public decimal? CentrDkid { get; set; }
|
||||||
|
|
||||||
|
public virtual ICollection<SkladnikDefinicjiKodu> SkladnikDefinicjiKodus { get; set; }
|
||||||
|
}
|
||||||
134
Pcm.Db/Entities/Dok.cs
Normal file
134
Pcm.Db/Entities/Dok.cs
Normal file
@ -0,0 +1,134 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Pcm.Db.Entities;
|
||||||
|
|
||||||
|
public class Dok
|
||||||
|
{
|
||||||
|
public Dok()
|
||||||
|
{
|
||||||
|
DokDodKths = new HashSet<DokDodKth>();
|
||||||
|
DokKontoBankowes = new HashSet<DokKontoBankowe>();
|
||||||
|
DokKurs = new HashSet<DokKur>();
|
||||||
|
DokPunkties = new HashSet<DokPunkty>();
|
||||||
|
DokWaluta = new HashSet<DokWalutum>();
|
||||||
|
Phrozliczenies = new HashSet<Phrozliczenie>();
|
||||||
|
PozDoks = new HashSet<PozDok>();
|
||||||
|
RegulaDoks = new HashSet<RegulaDok>();
|
||||||
|
RozbicieDoks = new HashSet<RozbicieDok>();
|
||||||
|
RozliczaDoks = new HashSet<Rozlicza>();
|
||||||
|
RozliczaRozliczanyDoks = new HashSet<Rozlicza>();
|
||||||
|
SklepDoks = new HashSet<SklepDok>();
|
||||||
|
TekstDoks = new HashSet<TekstDok>();
|
||||||
|
ZaleznoscPoprzedniDoks = new HashSet<Zaleznosc>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public decimal DokId { get; set; }
|
||||||
|
public decimal UzId { get; set; }
|
||||||
|
public decimal MagId { get; set; }
|
||||||
|
public DateTime Data { get; set; }
|
||||||
|
public int KolejnyWdniu { get; set; }
|
||||||
|
public DateTime DataDod { get; set; }
|
||||||
|
public DateTime DataPom { get; set; }
|
||||||
|
public string NrDok { get; set; }
|
||||||
|
public short TypDok { get; set; }
|
||||||
|
public short Aktywny { get; set; }
|
||||||
|
public short Opcja1 { get; set; }
|
||||||
|
public short Opcja2 { get; set; }
|
||||||
|
public short Opcja3 { get; set; }
|
||||||
|
public short Opcja4 { get; set; }
|
||||||
|
public short CenyZakBrutto { get; set; }
|
||||||
|
public short CenySpBrutto { get; set; }
|
||||||
|
public short FormaPlat { get; set; }
|
||||||
|
public short TerminPlat { get; set; }
|
||||||
|
public short PoziomCen { get; set; }
|
||||||
|
public decimal RabatProc { get; set; }
|
||||||
|
public decimal Netto { get; set; }
|
||||||
|
public decimal Podatek { get; set; }
|
||||||
|
public decimal NettoUslugi { get; set; }
|
||||||
|
public decimal PodatekUslugi { get; set; }
|
||||||
|
public decimal NettoDet { get; set; }
|
||||||
|
public decimal PodatekDet { get; set; }
|
||||||
|
public decimal NettoDetUslugi { get; set; }
|
||||||
|
public decimal PodatekDetUslugi { get; set; }
|
||||||
|
public decimal NettoMag { get; set; }
|
||||||
|
public decimal PodatekMag { get; set; }
|
||||||
|
public decimal NettoMagUslugi { get; set; }
|
||||||
|
public decimal PodatekMagUslugi { get; set; }
|
||||||
|
public decimal Razem { get; set; }
|
||||||
|
public decimal DoZaplaty { get; set; }
|
||||||
|
public decimal Zaplacono { get; set; }
|
||||||
|
public decimal Kwota1 { get; set; }
|
||||||
|
public decimal Kwota2 { get; set; }
|
||||||
|
public decimal Kwota3 { get; set; }
|
||||||
|
public decimal Kwota4 { get; set; }
|
||||||
|
public decimal Kwota5 { get; set; }
|
||||||
|
public decimal Kwota6 { get; set; }
|
||||||
|
public decimal Kwota7 { get; set; }
|
||||||
|
public decimal Kwota8 { get; set; }
|
||||||
|
public decimal Kwota9 { get; set; }
|
||||||
|
public decimal Kwota10 { get; set; }
|
||||||
|
public int Param1 { get; set; }
|
||||||
|
public int Param2 { get; set; }
|
||||||
|
public int Param3 { get; set; }
|
||||||
|
public int Param4 { get; set; }
|
||||||
|
public short EksportFk { get; set; }
|
||||||
|
public DateTime Zmiana { get; set; }
|
||||||
|
public int? NrKolejny { get; set; }
|
||||||
|
public int? NrKolejnyMag { get; set; }
|
||||||
|
public int? Param5 { get; set; }
|
||||||
|
public int? Param6 { get; set; }
|
||||||
|
public decimal? Kwota11 { get; set; }
|
||||||
|
public decimal? Kwota12 { get; set; }
|
||||||
|
public decimal? WalId { get; set; }
|
||||||
|
public decimal? Kurs { get; set; }
|
||||||
|
public decimal? CentrDokId { get; set; }
|
||||||
|
public short? Opcja5 { get; set; }
|
||||||
|
public short? Opcja6 { get; set; }
|
||||||
|
public short? Opcja7 { get; set; }
|
||||||
|
public short? Opcja8 { get; set; }
|
||||||
|
public DateTime? ZmianaPkt { get; set; }
|
||||||
|
public decimal? ZaplaconoPodatek { get; set; }
|
||||||
|
public decimal? ZaplaconoWkasie { get; set; }
|
||||||
|
[JsonIgnore]
|
||||||
|
public virtual Magazyn Mag { get; set; }
|
||||||
|
[JsonIgnore]
|
||||||
|
public virtual Uzytkownik Uz { get; set; }
|
||||||
|
[JsonIgnore]
|
||||||
|
public virtual Walutum Wal { get; set; }
|
||||||
|
[JsonIgnore]
|
||||||
|
public virtual DokKasa DokKasa { get; set; }
|
||||||
|
public virtual DokKontr DokKontr { get; set; }
|
||||||
|
[JsonIgnore]
|
||||||
|
public virtual Zaleznosc ZaleznoscDok { get; set; }
|
||||||
|
[JsonIgnore]
|
||||||
|
public virtual ICollection<DokDodKth> DokDodKths { get; set; }
|
||||||
|
[JsonIgnore]
|
||||||
|
public virtual ICollection<DokKontoBankowe> DokKontoBankowes { get; set; }
|
||||||
|
[JsonIgnore]
|
||||||
|
public virtual ICollection<DokKur> DokKurs { get; set; }
|
||||||
|
[JsonIgnore]
|
||||||
|
public virtual ICollection<DokPunkty> DokPunkties { get; set; }
|
||||||
|
[JsonIgnore]
|
||||||
|
public virtual ICollection<DokWalutum> DokWaluta { get; set; }
|
||||||
|
[JsonIgnore]
|
||||||
|
public virtual ICollection<Phrozliczenie> Phrozliczenies { get; set; }
|
||||||
|
public virtual ICollection<PozDok> PozDoks { get; set; }
|
||||||
|
[JsonIgnore]
|
||||||
|
public virtual ICollection<RegulaDok> RegulaDoks { get; set; }
|
||||||
|
[JsonIgnore]
|
||||||
|
public virtual ICollection<RozbicieDok> RozbicieDoks { get; set; }
|
||||||
|
[JsonIgnore]
|
||||||
|
public virtual ICollection<Rozlicza> RozliczaDoks { get; set; }
|
||||||
|
[JsonIgnore]
|
||||||
|
public virtual ICollection<Rozlicza> RozliczaRozliczanyDoks { get; set; }
|
||||||
|
[JsonIgnore]
|
||||||
|
public virtual ICollection<SklepDok> SklepDoks { get; set; }
|
||||||
|
[JsonIgnore]
|
||||||
|
public virtual ICollection<TekstDok> TekstDoks { get; set; }
|
||||||
|
[JsonIgnore]
|
||||||
|
public virtual ICollection<Zaleznosc> ZaleznoscPoprzedniDoks { get; set; }
|
||||||
|
}
|
||||||
13
Pcm.Db/Entities/DokDodKth.cs
Normal file
13
Pcm.Db/Entities/DokDodKth.cs
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Pcm.Db.Entities;
|
||||||
|
|
||||||
|
public class DokDodKth
|
||||||
|
{
|
||||||
|
public decimal DokId { get; set; }
|
||||||
|
public short Znaczenie { get; set; }
|
||||||
|
public decimal KontrId { get; set; }
|
||||||
|
|
||||||
|
public virtual Dok Dok { get; set; }
|
||||||
|
public virtual Kontrahent Kontr { get; set; }
|
||||||
|
}
|
||||||
12
Pcm.Db/Entities/DokKasa.cs
Normal file
12
Pcm.Db/Entities/DokKasa.cs
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Pcm.Db.Entities;
|
||||||
|
|
||||||
|
public class DokKasa
|
||||||
|
{
|
||||||
|
public decimal DokId { get; set; }
|
||||||
|
public decimal KasaId { get; set; }
|
||||||
|
|
||||||
|
public virtual Dok Dok { get; set; }
|
||||||
|
public virtual Kasa Kasa { get; set; }
|
||||||
|
}
|
||||||
12
Pcm.Db/Entities/DokKontoBankowe.cs
Normal file
12
Pcm.Db/Entities/DokKontoBankowe.cs
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Pcm.Db.Entities;
|
||||||
|
|
||||||
|
public class DokKontoBankowe
|
||||||
|
{
|
||||||
|
public decimal DokId { get; set; }
|
||||||
|
public decimal Kbid { get; set; }
|
||||||
|
|
||||||
|
public virtual Dok Dok { get; set; }
|
||||||
|
public virtual KontoBankowe Kb { get; set; }
|
||||||
|
}
|
||||||
15
Pcm.Db/Entities/DokKontr.cs
Normal file
15
Pcm.Db/Entities/DokKontr.cs
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Pcm.Db.Entities;
|
||||||
|
|
||||||
|
public class DokKontr
|
||||||
|
{
|
||||||
|
public decimal DokId { get; set; }
|
||||||
|
public decimal KontrId { get; set; }
|
||||||
|
|
||||||
|
[JsonIgnore]
|
||||||
|
public virtual Dok Dok { get; set; }
|
||||||
|
public virtual Kontrahent Kontr { get; set; }
|
||||||
|
}
|
||||||
18
Pcm.Db/Entities/DokKur.cs
Normal file
18
Pcm.Db/Entities/DokKur.cs
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Pcm.Db.Entities;
|
||||||
|
|
||||||
|
public class DokKur
|
||||||
|
{
|
||||||
|
public decimal DokId { get; set; }
|
||||||
|
public short Znaczenie { get; set; }
|
||||||
|
public decimal WalId { get; set; }
|
||||||
|
public decimal? Kurs { get; set; }
|
||||||
|
public DateTime? Data { get; set; }
|
||||||
|
public string NrTabeli { get; set; }
|
||||||
|
|
||||||
|
public virtual Dok Dok { get; set; }
|
||||||
|
public virtual Walutum Wal { get; set; }
|
||||||
|
}
|
||||||
15
Pcm.Db/Entities/DokPunkty.cs
Normal file
15
Pcm.Db/Entities/DokPunkty.cs
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Pcm.Db.Entities;
|
||||||
|
|
||||||
|
public class DokPunkty
|
||||||
|
{
|
||||||
|
public decimal DokId { get; set; }
|
||||||
|
public short Typ { get; set; }
|
||||||
|
public DateTime Kiedy { get; set; }
|
||||||
|
public decimal Kwota { get; set; }
|
||||||
|
|
||||||
|
public virtual Dok Dok { get; set; }
|
||||||
|
}
|
||||||
15
Pcm.Db/Entities/DokWalutum.cs
Normal file
15
Pcm.Db/Entities/DokWalutum.cs
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Pcm.Db.Entities;
|
||||||
|
|
||||||
|
public class DokWalutum
|
||||||
|
{
|
||||||
|
public decimal DokId { get; set; }
|
||||||
|
public decimal WalId { get; set; }
|
||||||
|
public decimal WalKwota { get; set; }
|
||||||
|
public decimal Kurs { get; set; }
|
||||||
|
public decimal DokKwota { get; set; }
|
||||||
|
|
||||||
|
public virtual Dok Dok { get; set; }
|
||||||
|
public virtual Walutum Wal { get; set; }
|
||||||
|
}
|
||||||
13
Pcm.Db/Entities/DostProd.cs
Normal file
13
Pcm.Db/Entities/DostProd.cs
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Pcm.Db.Entities;
|
||||||
|
|
||||||
|
public class DostProd
|
||||||
|
{
|
||||||
|
public decimal DostId { get; set; }
|
||||||
|
public decimal ProdId { get; set; }
|
||||||
|
public decimal RabatProd { get; set; }
|
||||||
|
|
||||||
|
public virtual Kontrahent Dost { get; set; }
|
||||||
|
public virtual Kontrahent Prod { get; set; }
|
||||||
|
}
|
||||||
15
Pcm.Db/Entities/Dostawca.cs
Normal file
15
Pcm.Db/Entities/Dostawca.cs
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Pcm.Db.Entities;
|
||||||
|
|
||||||
|
public class Dostawca
|
||||||
|
{
|
||||||
|
public decimal KontrId { get; set; }
|
||||||
|
public decimal TowId { get; set; }
|
||||||
|
public decimal CenaZak { get; set; }
|
||||||
|
public decimal RabatOdWart { get; set; }
|
||||||
|
public short? Narzucany { get; set; }
|
||||||
|
|
||||||
|
public virtual Kontrahent Kontr { get; set; }
|
||||||
|
public virtual Towar Tow { get; set; }
|
||||||
|
}
|
||||||
22
Pcm.Db/Entities/DzienRozl.cs
Normal file
22
Pcm.Db/Entities/DzienRozl.cs
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Pcm.Db.Entities;
|
||||||
|
|
||||||
|
public class DzienRozl
|
||||||
|
{
|
||||||
|
public DzienRozl()
|
||||||
|
{
|
||||||
|
DzienRozlParams = new HashSet<DzienRozlParam>();
|
||||||
|
StanPrtMags = new HashSet<StanPrtMag>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public DateTime Dzien { get; set; }
|
||||||
|
public short Status { get; set; }
|
||||||
|
public DateTime Zmiana { get; set; }
|
||||||
|
|
||||||
|
public virtual ICollection<DzienRozlParam> DzienRozlParams { get; set; }
|
||||||
|
public virtual ICollection<StanPrtMag> StanPrtMags { get; set; }
|
||||||
|
}
|
||||||
14
Pcm.Db/Entities/DzienRozlParam.cs
Normal file
14
Pcm.Db/Entities/DzienRozlParam.cs
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Pcm.Db.Entities;
|
||||||
|
|
||||||
|
public class DzienRozlParam
|
||||||
|
{
|
||||||
|
public DateTime Dzien { get; set; }
|
||||||
|
public short Znaczenie { get; set; }
|
||||||
|
public string Wartosc { get; set; }
|
||||||
|
|
||||||
|
public virtual DzienRozl DzienNavigation { get; set; }
|
||||||
|
}
|
||||||
14
Pcm.Db/Entities/FormZgod.cs
Normal file
14
Pcm.Db/Entities/FormZgod.cs
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Pcm.Db.Entities;
|
||||||
|
|
||||||
|
public class FormZgod
|
||||||
|
{
|
||||||
|
public decimal TypOsId { get; set; }
|
||||||
|
public decimal ZgId { get; set; }
|
||||||
|
public short Kolejnosc { get; set; }
|
||||||
|
public short? Wymagana { get; set; }
|
||||||
|
|
||||||
|
public virtual TypO TypOs { get; set; }
|
||||||
|
public virtual Zgodum Zg { get; set; }
|
||||||
|
}
|
||||||
27
Pcm.Db/Entities/FormaPlatnPos7.cs
Normal file
27
Pcm.Db/Entities/FormaPlatnPos7.cs
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Pcm.Db.Entities;
|
||||||
|
|
||||||
|
public class FormaPlatnPos7
|
||||||
|
{
|
||||||
|
public FormaPlatnPos7()
|
||||||
|
{
|
||||||
|
KasaFormaPlatns = new HashSet<KasaFormaPlatn>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public decimal FormaId { get; set; }
|
||||||
|
public string Nazwa { get; set; }
|
||||||
|
public short Typ { get; set; }
|
||||||
|
public short Reszta { get; set; }
|
||||||
|
public short? Autoryzacja { get; set; }
|
||||||
|
public string SerwisPlatniczy { get; set; }
|
||||||
|
public short Aktywny { get; set; }
|
||||||
|
public DateTime Zmiana { get; set; }
|
||||||
|
public decimal? CentrFormaId { get; set; }
|
||||||
|
public decimal? Kolejnosc { get; set; }
|
||||||
|
|
||||||
|
public virtual ICollection<KasaFormaPlatn> KasaFormaPlatns { get; set; }
|
||||||
|
}
|
||||||
11
Pcm.Db/Entities/FormaPlatnosci.cs
Normal file
11
Pcm.Db/Entities/FormaPlatnosci.cs
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Pcm.Db.Entities;
|
||||||
|
|
||||||
|
public class FormaPlatnosci
|
||||||
|
{
|
||||||
|
public short FormaPlat { get; set; }
|
||||||
|
public string Tekst { get; set; }
|
||||||
|
public short MinTermPlat { get; set; }
|
||||||
|
public short MaxTermPlat { get; set; }
|
||||||
|
}
|
||||||
13
Pcm.Db/Entities/GrWartosc.cs
Normal file
13
Pcm.Db/Entities/GrWartosc.cs
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Pcm.Db.Entities;
|
||||||
|
|
||||||
|
public class GrWartosc
|
||||||
|
{
|
||||||
|
public decimal GrId { get; set; }
|
||||||
|
public decimal ParId { get; set; }
|
||||||
|
public int Wartosc { get; set; }
|
||||||
|
|
||||||
|
public virtual GrupaTow Gr { get; set; }
|
||||||
|
public virtual Parametr Par { get; set; }
|
||||||
|
}
|
||||||
32
Pcm.Db/Entities/GrupaAkcyzowa.cs
Normal file
32
Pcm.Db/Entities/GrupaAkcyzowa.cs
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Pcm.Db.Entities;
|
||||||
|
|
||||||
|
public class GrupaAkcyzowa
|
||||||
|
{
|
||||||
|
public GrupaAkcyzowa()
|
||||||
|
{
|
||||||
|
PozAkcyzas = new HashSet<PozAkcyza>();
|
||||||
|
TabelaAkcyzowas = new HashSet<TabelaAkcyzowa>();
|
||||||
|
TowAkcyzas = new HashSet<TowAkcyza>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public decimal GrAkcId { get; set; }
|
||||||
|
public string Kod { get; set; }
|
||||||
|
public string Nazwa { get; set; }
|
||||||
|
public string AkcJm { get; set; }
|
||||||
|
public string OpcjeWzoru { get; set; }
|
||||||
|
public string PrefiksyCn { get; set; }
|
||||||
|
public string Opis { get; set; }
|
||||||
|
public decimal? CentrGrAkcId { get; set; }
|
||||||
|
public DateTime Zmiana { get; set; }
|
||||||
|
public string DodJm { get; set; }
|
||||||
|
public decimal? IleDodJmwakcJm { get; set; }
|
||||||
|
|
||||||
|
public virtual ICollection<PozAkcyza> PozAkcyzas { get; set; }
|
||||||
|
public virtual ICollection<TabelaAkcyzowa> TabelaAkcyzowas { get; set; }
|
||||||
|
public virtual ICollection<TowAkcyza> TowAkcyzas { get; set; }
|
||||||
|
}
|
||||||
19
Pcm.Db/Entities/GrupaTow.cs
Normal file
19
Pcm.Db/Entities/GrupaTow.cs
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Pcm.Db.Entities;
|
||||||
|
|
||||||
|
public class GrupaTow
|
||||||
|
{
|
||||||
|
public GrupaTow()
|
||||||
|
{
|
||||||
|
GrWartoscs = new HashSet<GrWartosc>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public decimal GrId { get; set; }
|
||||||
|
public string Nazwa { get; set; }
|
||||||
|
public string Opis { get; set; }
|
||||||
|
|
||||||
|
public virtual ICollection<GrWartosc> GrWartoscs { get; set; }
|
||||||
|
}
|
||||||
12
Pcm.Db/Entities/GrupaUz.cs
Normal file
12
Pcm.Db/Entities/GrupaUz.cs
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Pcm.Db.Entities;
|
||||||
|
|
||||||
|
public class GrupaUz
|
||||||
|
{
|
||||||
|
public decimal UzId { get; set; }
|
||||||
|
public decimal RolaId { get; set; }
|
||||||
|
|
||||||
|
public virtual Uzytkownik Rola { get; set; }
|
||||||
|
public virtual Uzytkownik Uz { get; set; }
|
||||||
|
}
|
||||||
22
Pcm.Db/Entities/HarmCeny.cs
Normal file
22
Pcm.Db/Entities/HarmCeny.cs
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Pcm.Db.Entities;
|
||||||
|
|
||||||
|
public class HarmCeny
|
||||||
|
{
|
||||||
|
public decimal HarmId { get; set; }
|
||||||
|
public decimal TowId { get; set; }
|
||||||
|
public decimal? CenaDet { get; set; }
|
||||||
|
public decimal? CenaHurt { get; set; }
|
||||||
|
public decimal? CenaDod { get; set; }
|
||||||
|
public decimal? CenaNoc { get; set; }
|
||||||
|
public decimal? Cena5 { get; set; }
|
||||||
|
public decimal? Cena6 { get; set; }
|
||||||
|
public decimal? ProgPromocji { get; set; }
|
||||||
|
public short? CenaOtwarta { get; set; }
|
||||||
|
public string Inne { get; set; }
|
||||||
|
public short? Stawka { get; set; }
|
||||||
|
|
||||||
|
public virtual HarmWpi Harm { get; set; }
|
||||||
|
public virtual Towar Tow { get; set; }
|
||||||
|
}
|
||||||
16
Pcm.Db/Entities/HarmCykl.cs
Normal file
16
Pcm.Db/Entities/HarmCykl.cs
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Pcm.Db.Entities;
|
||||||
|
|
||||||
|
public class HarmCykl
|
||||||
|
{
|
||||||
|
public decimal HarmId { get; set; }
|
||||||
|
public short OdDnia { get; set; }
|
||||||
|
public short OdGodz { get; set; }
|
||||||
|
public short OdMin { get; set; }
|
||||||
|
public short? DoDnia { get; set; }
|
||||||
|
public short? DoGodz { get; set; }
|
||||||
|
public short? DoMin { get; set; }
|
||||||
|
|
||||||
|
public virtual HarmWpi Harm { get; set; }
|
||||||
|
}
|
||||||
13
Pcm.Db/Entities/HarmHarm.cs
Normal file
13
Pcm.Db/Entities/HarmHarm.cs
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Pcm.Db.Entities;
|
||||||
|
|
||||||
|
public class HarmHarm
|
||||||
|
{
|
||||||
|
public decimal HarmId { get; set; }
|
||||||
|
public short Znaczenie { get; set; }
|
||||||
|
public decimal PoprzHarmId { get; set; }
|
||||||
|
|
||||||
|
public virtual HarmWpi Harm { get; set; }
|
||||||
|
public virtual HarmWpi PoprzHarm { get; set; }
|
||||||
|
}
|
||||||
38
Pcm.Db/Entities/HarmWpi.cs
Normal file
38
Pcm.Db/Entities/HarmWpi.cs
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Pcm.Db.Entities;
|
||||||
|
|
||||||
|
public class HarmWpi
|
||||||
|
{
|
||||||
|
public HarmWpi()
|
||||||
|
{
|
||||||
|
HarmCenies = new HashSet<HarmCeny>();
|
||||||
|
HarmCykls = new HashSet<HarmCykl>();
|
||||||
|
HarmHarmHarms = new HashSet<HarmHarm>();
|
||||||
|
HarmHarmPoprzHarms = new HashSet<HarmHarm>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public decimal HarmId { get; set; }
|
||||||
|
public short HarmTyp { get; set; }
|
||||||
|
public string Nazwa { get; set; }
|
||||||
|
public string Opcje { get; set; }
|
||||||
|
public short Aktywny { get; set; }
|
||||||
|
public short Uwzgledniony { get; set; }
|
||||||
|
public DateTime Zmiana { get; set; }
|
||||||
|
public decimal? PolId { get; set; }
|
||||||
|
public decimal? CentrHarmId { get; set; }
|
||||||
|
public DateTime? WaznyOd { get; set; }
|
||||||
|
public DateTime? WaznyDo { get; set; }
|
||||||
|
public decimal? KrajId { get; set; }
|
||||||
|
public short? CenyBrutto { get; set; }
|
||||||
|
|
||||||
|
public virtual Kraj Kraj { get; set; }
|
||||||
|
public virtual Polityka Pol { get; set; }
|
||||||
|
public virtual ICollection<HarmCeny> HarmCenies { get; set; }
|
||||||
|
public virtual ICollection<HarmCykl> HarmCykls { get; set; }
|
||||||
|
public virtual ICollection<HarmHarm> HarmHarmHarms { get; set; }
|
||||||
|
public virtual ICollection<HarmHarm> HarmHarmPoprzHarms { get; set; }
|
||||||
|
}
|
||||||
26
Pcm.Db/Entities/Istw.cs
Normal file
26
Pcm.Db/Entities/Istw.cs
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Pcm.Db.Entities;
|
||||||
|
|
||||||
|
public class Istw
|
||||||
|
{
|
||||||
|
public Istw()
|
||||||
|
{
|
||||||
|
Blokada = new HashSet<Blokadum>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public decimal TowId { get; set; }
|
||||||
|
public decimal MagId { get; set; }
|
||||||
|
public decimal StanMag { get; set; }
|
||||||
|
public decimal BlokadaMag { get; set; }
|
||||||
|
public decimal CenaMag { get; set; }
|
||||||
|
public decimal StanMin { get; set; }
|
||||||
|
public decimal StanMax { get; set; }
|
||||||
|
public decimal? RezerwacjaMag { get; set; }
|
||||||
|
|
||||||
|
public virtual Magazyn Mag { get; set; }
|
||||||
|
public virtual Towar Tow { get; set; }
|
||||||
|
public virtual ICollection<Blokadum> Blokada { get; set; }
|
||||||
|
}
|
||||||
22
Pcm.Db/Entities/Jm.cs
Normal file
22
Pcm.Db/Entities/Jm.cs
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Pcm.Db.Entities;
|
||||||
|
|
||||||
|
public class Jm
|
||||||
|
{
|
||||||
|
public Jm()
|
||||||
|
{
|
||||||
|
KodWazonies = new HashSet<KodWazony>();
|
||||||
|
Towars = new HashSet<Towar>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public decimal Jmid { get; set; }
|
||||||
|
public string Nazwa { get; set; }
|
||||||
|
public short Precyzja { get; set; }
|
||||||
|
public decimal? CentrJmid { get; set; }
|
||||||
|
|
||||||
|
public virtual ICollection<KodWazony> KodWazonies { get; set; }
|
||||||
|
public virtual ICollection<Towar> Towars { get; set; }
|
||||||
|
}
|
||||||
31
Pcm.Db/Entities/KartaLoj.cs
Normal file
31
Pcm.Db/Entities/KartaLoj.cs
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Pcm.Db.Entities;
|
||||||
|
|
||||||
|
public class KartaLoj
|
||||||
|
{
|
||||||
|
public KartaLoj()
|
||||||
|
{
|
||||||
|
NrRejKarta = new HashSet<NrRejKartum>();
|
||||||
|
ZdarzLojs = new HashSet<ZdarzLoj>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public decimal KartaId { get; set; }
|
||||||
|
public decimal KontoId { get; set; }
|
||||||
|
public short TypKarty { get; set; }
|
||||||
|
public string KodKarty { get; set; }
|
||||||
|
public DateTime? WaznaOd { get; set; }
|
||||||
|
public DateTime? WaznaDo { get; set; }
|
||||||
|
public DateTime? Uniewazniono { get; set; }
|
||||||
|
public string Posiadacz { get; set; }
|
||||||
|
public string Opis1 { get; set; }
|
||||||
|
public string Opis2 { get; set; }
|
||||||
|
public decimal? CentrKartaId { get; set; }
|
||||||
|
|
||||||
|
public virtual KontoLoj Konto { get; set; }
|
||||||
|
public virtual ICollection<NrRejKartum> NrRejKarta { get; set; }
|
||||||
|
public virtual ICollection<ZdarzLoj> ZdarzLojs { get; set; }
|
||||||
|
}
|
||||||
30
Pcm.Db/Entities/KasKod.cs
Normal file
30
Pcm.Db/Entities/KasKod.cs
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Pcm.Db.Entities;
|
||||||
|
|
||||||
|
public class KasKod
|
||||||
|
{
|
||||||
|
public decimal KasaId { get; set; }
|
||||||
|
public decimal TowId { get; set; }
|
||||||
|
public short Kolejnosc { get; set; }
|
||||||
|
public string Kod { get; set; }
|
||||||
|
public short Status { get; set; }
|
||||||
|
public short ZmianyCen { get; set; }
|
||||||
|
public short ZmianyInne { get; set; }
|
||||||
|
public short BylyZmianyCen { get; set; }
|
||||||
|
public short BylyZmianyInne { get; set; }
|
||||||
|
public int? KasPrefPlu { get; set; }
|
||||||
|
public int? Plu { get; set; }
|
||||||
|
public short? DodIndeks { get; set; }
|
||||||
|
public short? Stawka { get; set; }
|
||||||
|
public short? TypTowaru { get; set; }
|
||||||
|
public decimal? IleWkodzie { get; set; }
|
||||||
|
public short? PoziomCen { get; set; }
|
||||||
|
public string Skrot { get; set; }
|
||||||
|
public string KodOpak { get; set; }
|
||||||
|
public int? Pluopak { get; set; }
|
||||||
|
public string Rezerwa { get; set; }
|
||||||
|
|
||||||
|
public virtual Kasa Kasa { get; set; }
|
||||||
|
public virtual Towar Tow { get; set; }
|
||||||
|
}
|
||||||
12
Pcm.Db/Entities/KasPar.cs
Normal file
12
Pcm.Db/Entities/KasPar.cs
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Pcm.Db.Entities;
|
||||||
|
|
||||||
|
public class KasPar
|
||||||
|
{
|
||||||
|
public decimal KasaId { get; set; }
|
||||||
|
public string ParNazwa { get; set; }
|
||||||
|
public string ParWartosc { get; set; }
|
||||||
|
|
||||||
|
public virtual Kasa Kasa { get; set; }
|
||||||
|
}
|
||||||
20
Pcm.Db/Entities/KasTow.cs
Normal file
20
Pcm.Db/Entities/KasTow.cs
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Pcm.Db.Entities;
|
||||||
|
|
||||||
|
public class KasTow
|
||||||
|
{
|
||||||
|
public decimal KasaId { get; set; }
|
||||||
|
public string KodWyslany { get; set; }
|
||||||
|
public decimal TowId { get; set; }
|
||||||
|
public short TypTowaru { get; set; }
|
||||||
|
public short Dodatkowy { get; set; }
|
||||||
|
public int Plu { get; set; }
|
||||||
|
public short DodIndeks { get; set; }
|
||||||
|
public short ZmianyCen { get; set; }
|
||||||
|
public short ZmianyInne { get; set; }
|
||||||
|
public short FlagaExp { get; set; }
|
||||||
|
|
||||||
|
public virtual Kasa Kasa { get; set; }
|
||||||
|
public virtual Towar Tow { get; set; }
|
||||||
|
}
|
||||||
41
Pcm.Db/Entities/Kasa.cs
Normal file
41
Pcm.Db/Entities/Kasa.cs
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Pcm.Db.Entities;
|
||||||
|
|
||||||
|
public class Kasa
|
||||||
|
{
|
||||||
|
public Kasa()
|
||||||
|
{
|
||||||
|
DokKasas = new HashSet<DokKasa>();
|
||||||
|
KasKods = new HashSet<KasKod>();
|
||||||
|
KasPars = new HashSet<KasPar>();
|
||||||
|
KasTows = new HashSet<KasTow>();
|
||||||
|
KasaFormaPlatns = new HashSet<KasaFormaPlatn>();
|
||||||
|
Paragons = new HashSet<Paragon>();
|
||||||
|
ProfilKasas = new HashSet<ProfilKasa>();
|
||||||
|
Przydzials = new HashSet<Przydzial>();
|
||||||
|
Zlecenies = new HashSet<Zlecenie>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public decimal KasaId { get; set; }
|
||||||
|
public decimal MagId { get; set; }
|
||||||
|
public short Numer { get; set; }
|
||||||
|
public string Nazwa { get; set; }
|
||||||
|
public short Rodzaj { get; set; }
|
||||||
|
public string Typ { get; set; }
|
||||||
|
public short Aktywny { get; set; }
|
||||||
|
public string Stanowisko { get; set; }
|
||||||
|
|
||||||
|
public virtual Magazyn Mag { get; set; }
|
||||||
|
public virtual ICollection<DokKasa> DokKasas { get; set; }
|
||||||
|
public virtual ICollection<KasKod> KasKods { get; set; }
|
||||||
|
public virtual ICollection<KasPar> KasPars { get; set; }
|
||||||
|
public virtual ICollection<KasTow> KasTows { get; set; }
|
||||||
|
public virtual ICollection<KasaFormaPlatn> KasaFormaPlatns { get; set; }
|
||||||
|
public virtual ICollection<Paragon> Paragons { get; set; }
|
||||||
|
public virtual ICollection<ProfilKasa> ProfilKasas { get; set; }
|
||||||
|
public virtual ICollection<Przydzial> Przydzials { get; set; }
|
||||||
|
public virtual ICollection<Zlecenie> Zlecenies { get; set; }
|
||||||
|
}
|
||||||
13
Pcm.Db/Entities/KasaFormaPlatn.cs
Normal file
13
Pcm.Db/Entities/KasaFormaPlatn.cs
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Pcm.Db.Entities;
|
||||||
|
|
||||||
|
public class KasaFormaPlatn
|
||||||
|
{
|
||||||
|
public decimal FormaId { get; set; }
|
||||||
|
public decimal KasaId { get; set; }
|
||||||
|
public short Aktywny { get; set; }
|
||||||
|
|
||||||
|
public virtual FormaPlatnPos7 Forma { get; set; }
|
||||||
|
public virtual Kasa Kasa { get; set; }
|
||||||
|
}
|
||||||
14
Pcm.Db/Entities/KatParam.cs
Normal file
14
Pcm.Db/Entities/KatParam.cs
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Pcm.Db.Entities;
|
||||||
|
|
||||||
|
public class KatParam
|
||||||
|
{
|
||||||
|
public decimal KatId { get; set; }
|
||||||
|
public decimal ParId { get; set; }
|
||||||
|
public short Kolejnosc { get; set; }
|
||||||
|
public int WartDom { get; set; }
|
||||||
|
|
||||||
|
public virtual Kategorium Kat { get; set; }
|
||||||
|
public virtual Parametr Par { get; set; }
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user