소스 검색

Added SupplierDiscounts to Logikal Interface

frankvandenbos 2 주 전
부모
커밋
18ff676c9c

+ 40 - 7
InABox.Avalonia.Platform.Desktop/Desktop.PdfRenderer.cs

@@ -1,6 +1,7 @@
 using InABox.Core;
-using PDFtoImage;
-using SkiaSharp;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.PdfToImageConverter;
 
 namespace InABox.Avalonia.Platform.Desktop;
 
@@ -11,17 +12,49 @@ public class Desktop_PdfRenderer : IPdfRenderer
         if (pdf?.Any() != true)
             return null;
         
-        var result = Conversion.ToImage(pdf, page, options: new RenderOptions(Dpi: dpi));
-        using var ms = new MemoryStream();
-        result.Encode(ms, SKEncodedImageFormat.Jpeg, 65);
-        return ms.ToArray();
+        using (var inData = new MemoryStream(pdf))
+        {
+            using (var converter = new PdfToImageConverter(inData))
+            {
+                using (var outData = new MemoryStream())
+                {
+                    converter.Convert(page,true,false)
+                        .CopyTo(outData);
+                    return outData.ToArray();
+                }
+
+            }
+        }
+        
     }
 
     public Task<byte[]?> PdfToImageAsync(byte[]? pdf, int page, int dpi)
         => Task.Run(() => PdfToImage(pdf, page, dpi));
 
     public byte[]? ImageToPdf(byte[]? image)
-        => null;
+    { 
+        if (image?.Any() != true)
+            return null;
+
+        using var imgStream = new MemoryStream(image);
+        
+        var bmp = new PdfBitmap(imgStream);
+        
+        var doc = new PdfDocument();
+        
+        var section = doc.Sections.Add();
+        section.PageSettings.Margins.All = 0;
+        section.PageSettings.Width = bmp.Width;
+        section.PageSettings.Height = bmp.Height;
+        
+        var page = section.Pages.Add();
+        page.Graphics.DrawImage(bmp, 0, 0, page.Size.Width, page.Size.Height);
+
+        using var docStream = new MemoryStream();
+        
+        doc.Save(docStream);
+        return docStream.GetBuffer();
+    }
 
     public Task<byte[]?> ImageToPdfAsync(byte[]? image)
         => Task.Run(() => ImageToPdf(image));

+ 2 - 0
InABox.Avalonia.Platform.Desktop/InABox.Avalonia.Platform.Desktop.csproj

@@ -19,6 +19,8 @@
         <PackageReference Include="Microsoft.Maui.Essentials" Version="9.0.71" />
         <PackageReference Include="PDFtoImage" Version="4.1.1" />
         <PackageReference Include="SkiaSharp" Version="2.88.9" />
+        <PackageReference Include="Syncfusion.Pdf.Wpf" Version="29.2.7" />
+        <PackageReference Include="Syncfusion.PdfToImageConverter.WPF" Version="29.2.7" />
     </ItemGroup>
     
 </Project>

+ 3 - 2
InABox.Integration.Logikal/Classes/BOM/ILogikalBOM.cs

@@ -2,8 +2,9 @@ using InABox.Integration.Awg;
 
 namespace InABox.Integration.Logikal
 {
-    public interface ILogikalBOM<TGroup, TStyle, TSupplier, TProfile, TGasket, TComponent, TGlass, TLabour> 
-        : IAwgBOM<TGroup, TStyle, TSupplier, TProfile,TGasket,TComponent,TGlass,TLabour> 
+    public interface ILogikalBOM<TDiscount, TGroup, TStyle, TSupplier, TProfile, TGasket, TComponent, TGlass, TLabour> 
+        : IAwgBOM<TDiscount, TGroup, TStyle, TSupplier, TProfile,TGasket,TComponent,TGlass,TLabour> 
+        where TDiscount : ILogikalDiscount
         where TGroup : ILogikalGroup
         where TStyle : ILogikalStyle
         where TSupplier : ILogikalSupplier

+ 3 - 2
InABox.Integration.Logikal/Classes/Elevation/ILogikalElevationDetail.cs

@@ -2,9 +2,10 @@ using System.Collections.Generic;
 
 namespace InABox.Integration.Logikal
 {
-    public interface ILogikalElevationDetail<TGroup, TStyle, TSupplier, TProfile, TGasket, TComponent, TGlass, TLabour>  : 
-        ILogikalBOM<TGroup, TStyle, TSupplier, TProfile, TGasket, TComponent, TGlass, TLabour>,
+    public interface ILogikalElevationDetail<TDiscount,TGroup, TStyle, TSupplier, TProfile, TGasket, TComponent, TGlass, TLabour>  : 
+        ILogikalBOM<TDiscount,TGroup, TStyle, TSupplier, TProfile, TGasket, TComponent, TGlass, TLabour>,
         ILogikalElevationSummary
+        where TDiscount : ILogikalDiscount
         where TGroup : ILogikalGroup
         where TStyle : ILogikalStyle
         where TSupplier : ILogikalSupplier

+ 9 - 0
InABox.Integration.Logikal/Classes/Product/ILogikalDiscount.cs

@@ -0,0 +1,9 @@
+using InABox.Integration.Awg;
+
+namespace InABox.Integration.Logikal
+{
+    public interface ILogikalDiscount : IAwgDiscount
+    {
+        
+    }
+}

+ 3 - 2
InABox.Integration.Logikal/Requests/BOM/LogikalBOMResponse.cs

@@ -1,8 +1,9 @@
 namespace InABox.Integration.Logikal
 {
 
-    public class LogikalBOMResponse<TBOM,TGroup,TStyle,TSupplier,TProfile,TGasket,TComponent,TGlass,TLabour> : LogikalResponse
-        where TBOM : ILogikalBOM<TGroup,TStyle,TSupplier,TProfile,TGasket,TComponent,TGlass,TLabour>, new()
+    public class LogikalBOMResponse<TBOM,TDiscount,TGroup,TStyle,TSupplier,TProfile,TGasket,TComponent,TGlass,TLabour> : LogikalResponse
+        where TBOM : ILogikalBOM<TDiscount,TGroup,TStyle,TSupplier,TProfile,TGasket,TComponent,TGlass,TLabour>, new()
+        where TDiscount : ILogikalDiscount
         where TGroup : ILogikalGroup
         where TStyle : ILogikalStyle
         where TSupplier : ILogikalSupplier

+ 3 - 2
InABox.Integration.Logikal/Requests/Elevation/LogikalElevationDetailResponse.cs

@@ -4,8 +4,9 @@ using System.Linq;
 
 namespace InABox.Integration.Logikal
 {
-    public class LogikalElevationDetailResponse<TElevation,TGroup,TStyle,TSupplier,TProfile,TGasket,TComponent,TGlass,TLabour> : LogikalResponse
-        where TElevation : ILogikalElevationDetail<TGroup,TStyle,TSupplier,TProfile,TGasket,TComponent,TGlass,TLabour>
+    public class LogikalElevationDetailResponse<TElevation,TDiscount,TGroup,TStyle,TSupplier,TProfile,TGasket,TComponent,TGlass,TLabour> : LogikalResponse
+        where TElevation : ILogikalElevationDetail<TDiscount,TGroup,TStyle,TSupplier,TProfile,TGasket,TComponent,TGlass,TLabour>
+        where TDiscount : ILogikalDiscount
         where TGroup : ILogikalGroup
         where TStyle : ILogikalStyle
         where TSupplier : ILogikalSupplier

+ 3 - 2
InABox.Integration.V6/Classes/BOM/IV6BOM.cs

@@ -2,8 +2,9 @@ using InABox.Integration.Awg;
 
 namespace InABox.Integration.V6
 {
-    public interface IV6BOM<TGroup, TStyle, TSupplier, TProfile,TGasket,TComponent,TGlass,TLabour> 
-        : IAwgBOM<TGroup, TStyle, TSupplier, TProfile,TGasket,TComponent,TGlass,TLabour> 
+    public interface IV6BOM<TDiscount, TGroup, TStyle, TSupplier, TProfile,TGasket,TComponent,TGlass,TLabour> 
+        : IAwgBOM<TDiscount, TGroup, TStyle, TSupplier, TProfile,TGasket,TComponent,TGlass,TLabour> 
+        where TDiscount : IV6Discount
         where TGroup : IV6Group
         where TStyle : IV6Style
         where TSupplier : IV6Supplier

+ 9 - 0
InABox.Integration.V6/Classes/BOM/IV6Discount.cs

@@ -0,0 +1,9 @@
+using InABox.Integration.Awg;
+
+namespace InABox.Integration.V6
+{
+    public interface IV6Discount : IAwgDiscount
+    {
+        
+    }
+}

+ 3 - 1
InABox.Integration/Awg/BOM/IAwgBOM.cs

@@ -2,7 +2,8 @@ using System.Collections.Generic;
 
 namespace InABox.Integration.Awg
 {
-    public interface IAwgBOM<TGroup, TStyle, TSupplier,TProfile, TGasket, TComponent, TGlass, TLabour> : IIntegrationBOM
+    public interface IAwgBOM<TDiscount, TGroup, TStyle, TSupplier,TProfile, TGasket, TComponent, TGlass, TLabour> : IIntegrationBOM
+        where TDiscount : IAwgDiscount 
         where TGroup : IAwgGroup
         where TStyle : IAwgStyle
         where TSupplier : IAwgSupplier
@@ -12,6 +13,7 @@ namespace InABox.Integration.Awg
         where TGlass : IAwgGlass
         where TLabour : IAwgLabour
     {
+        IEnumerable<TDiscount> Discounts { get; set; }
         IEnumerable<TGroup> Groups { get; set; }
         IEnumerable<TStyle> Styles { get; set; }
         IEnumerable<TSupplier> Suppliers { get; set; }

+ 7 - 0
InABox.Integration/Awg/Product/IAwgDiscount.cs

@@ -0,0 +1,7 @@
+namespace InABox.Integration.Awg
+{
+    public interface IAwgDiscount : IIntegrationDiscount, IAwgItem
+    {
+        
+    }
+}

+ 8 - 0
InABox.Integration/Base/Product/IIntegrationDiscount.cs

@@ -0,0 +1,8 @@
+namespace InABox.Integration
+{
+    public interface IIntegrationDiscount : IIntegrationItem
+    {
+        string SupplierCode { get; set; }
+        double Discount { get; set; }
+    }
+}

+ 1 - 3
InABox.Integration/Base/Supplier/IIntegrationSupplier.cs

@@ -1,8 +1,6 @@
 namespace InABox.Integration
 {
-    public interface IIntegrationSupplier
+    public interface IIntegrationSupplier : IIntegrationItem
     {
-        string Code {get; set;}
-        string Description {get; set;}
     }
 }

+ 2 - 2
inabox.wpf/DynamicGrid/DynamicGridCommon.cs

@@ -518,8 +518,8 @@ public class SaveColumnsEventArgs
 }
 public delegate void SaveColumnsEvent(object sender, SaveColumnsEventArgs args);
 
-public class GetAvailableColumnsEventArgs(IEnumerable<DynamicGridColumn> columns)
+public class GetAvailableColumnsEventArgs(List<DynamicGridColumn> columns)
 {
-    public IEnumerable<DynamicGridColumn> Columns { get; set; } = columns;
+    public List<DynamicGridColumn> Columns { get; set; } = columns;
 }
 public delegate void GetAvailableColumnsEvent(GetAvailableColumnsEventArgs args);

+ 3 - 1
inabox.wpf/DynamicGrid/Grids/DynamicDataGrid.cs

@@ -328,6 +328,8 @@ public class DynamicDataGrid<TEntity> : DynamicGrid<TEntity>, IDynamicDataGrid w
 
     public override void DeleteItems(params CoreRow[] rows)
     {
+        //var deletes = rows.Select(x => x.ToObject<TEntity>()).ToArray();
+        
         var deletes = new List<TEntity>();
         foreach (var row in rows)
         {
@@ -336,7 +338,7 @@ public class DynamicDataGrid<TEntity> : DynamicGrid<TEntity>, IDynamicDataGrid w
             {
                 CoreUtils.SetPropertyValue(delete, column.Property, row[column.Property]);
             }
-
+        
             deletes.Add(delete);
         }