Просмотр исходного кода

PRS DESKTOP / CLASSES - added some staging classes for uploading setouts

Nick-PRSDigital@bitbucket.org 2 лет назад
Родитель
Сommit
6ae053db5c

+ 0 - 19
prs.classes/ReservationManagementTreatmentModel.cs

@@ -1,19 +0,0 @@
-using InABox.Core;
-using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace Comal.Classes
-{
-    public class ReservationManagementTreatmentDataModel : DataModel
-    {
-        public ReservationManagementTreatmentDataModel(PurchaseOrder order, Delivery delivery)
-        {
-            AddTable(new Filter<PurchaseOrder>(x => x.ID).IsEqualTo(order.ID), null, true);
-            AddChildTable<PurchaseOrder, PurchaseOrderItem>(x => x.ID, x => x.PurchaseOrderLink.ID, isdefault: true);          
-
-            AddTable(new Filter<Delivery>(x => x.ID).IsEqualTo(delivery.ID), null, true);
-        }
-        public override string Name => "Reservation Management Treatment";
-    }
-}

+ 22 - 0
prs.classes/StagingSetout.cs

@@ -0,0 +1,22 @@
+using InABox.Core;
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Comal.Classes
+{
+    public class StagingSetout : Entity, IPersistent, IRemotable
+    {
+        [UniqueCodeEditor(Visible = Visible.Default, Editable = Editable.Disabled)]
+        public string Number { get; set; }
+
+        [NullEditor]
+        public JobLink JobLink { get; set; }
+        public SetoutLink Setout { get; set; }
+
+        public StagingSetout()
+        {
+            JobLink = new JobLink();
+        }
+    }
+}

+ 10 - 0
prs.classes/StagingSetoutDocument.cs

@@ -0,0 +1,10 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Comal.Classes
+{
+    internal class StagingSetoutDocument
+    {
+    }
+}

+ 25 - 0
prs.classes/StagingSetoutLink.cs

@@ -0,0 +1,25 @@
+using InABox.Core;
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Comal.Classes
+{
+    public class StagingSetoutLink : EntityLink<StagingSetout>
+    {
+        [SecondaryIndex]
+        [LookupEditor(typeof(StagingSetout))]
+        public override Guid ID { get; set; }
+
+        [TextBoxEditor(Editable = Editable.Hidden)]
+        public string Number { get; set; }
+
+        [NullEditor]
+        public JobLink JobLink { get; set; }
+
+        public StagingSetoutLink()
+        {
+            JobLink = new JobLink();
+        }
+    }
+}

+ 3 - 0
prs.desktop/MainWindow.xaml

@@ -333,6 +333,9 @@
                     <fluent:Button x:Name="ProjectPlannerButton" Header="Project Planner"
                                    LargeIcon="pack://application:,,,/Resources/calendar.png"
                                    Click="ProjectPlanner_Checked" MinWidth="60" />
+                    <fluent:Button x:Name="SetoutImportButton" Header="Project Planner"
+                                   LargeIcon="pack://application:,,,/Resources/pdficon.png"
+                                   Click="SetoutImport_Checked" MinWidth="60" />
                     <fluent:Button x:Name="ServiceButton" Header="Service"
                                    LargeIcon="pack://application:,,,/Resources/service.png"
                                    Click="Service_Checked" MinWidth="60" />

+ 5 - 1
prs.desktop/MainWindow.xaml.cs

@@ -4168,8 +4168,12 @@ namespace PRSDesktop
             Close();
         }
 
+
         #endregion
 
-       
+        private void SetoutImport_Checked(object sender, RoutedEventArgs e)
+        {
+
+        }
     }
 }

+ 24 - 0
prs.desktop/Panels/Staging/StagingPanel.xaml

@@ -0,0 +1,24 @@
+<UserControl x:Class="PRSDesktop.StagingPanel"
+             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
+             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
+             xmlns:dynamicgrid="clr-namespace:InABox.DynamicGrid;assembly=InABox.Wpf"
+             xmlns:local="clr-namespace:PRSDesktop"
+             mc:Ignorable="d" 
+             d:DesignHeight="450" d:DesignWidth="800">
+
+    <dynamicgrid:DynamicSplitPanel x:Name="mainPanel" View="Combined" MasterCaption="Setouts Folder">
+
+        <dynamicgrid:DynamicSplitPanel.Master>
+            
+        </dynamicgrid:DynamicSplitPanel.Master>
+        
+        <dynamicgrid:DynamicSplitPanel.Detail>
+            <dynamicgrid:DynamicSplitPanel x:Name="nestedPanel">
+                
+            </dynamicgrid:DynamicSplitPanel>
+        </dynamicgrid:DynamicSplitPanel.Detail>
+    </dynamicgrid:DynamicSplitPanel>
+    
+</UserControl>

+ 28 - 0
prs.desktop/Panels/Staging/StagingPanel.xaml.cs

@@ -0,0 +1,28 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+
+namespace PRSDesktop
+{
+    /// <summary>
+    /// Interaction logic for StagingPanel.xaml
+    /// </summary>
+    public partial class StagingPanel : UserControl
+    {
+        public StagingPanel()
+        {
+            InitializeComponent();
+        }
+    }
+}

+ 57 - 0
prs.desktop/StagingSetoutGrid.cs

@@ -0,0 +1,57 @@
+using Comal.Classes;
+using InABox.Clients;
+using InABox.Core;
+using InABox.DynamicGrid;
+using javax.print.attribute.standard;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PRSDesktop
+{
+    public class StagingSetoutGrid : DynamicDataGrid<StagingSetout>
+    {
+        public StagingSetoutGrid() 
+        {
+            CoreTable table = new Client<StagingSetout>().Query(new Filter<StagingSetout>(x => x.Setout.ID).IsEqualTo(Guid.Empty));
+
+            string folder = @"U:\" + "9999" + " " + "Test Job" + @"\COM-AL SETOUTS";
+            var dir = new DirectoryInfo(folder);
+            var files = dir.EnumerateFiles();
+            foreach ( var file in files) 
+            {
+                if (!file.FullName.EndsWith(".pdf"))
+                    continue;
+
+                if (CheckStagingExists(file))
+                    continue;
+
+                Stream stream = new FileStream(file.FullName, FileMode.Open, FileAccess.Read, FileShare.Read);
+                byte[] pdfData = new byte[stream.Length];
+                stream.Read(pdfData, 0, System.Convert.ToInt32(pdfData.Length));
+
+                Document doc = new Document();
+                doc.FileName = file.Name;
+                doc.Data = pdfData;
+
+                new Client<Document>().Save(doc, "Created from sync setout function");             
+            }
+
+        }
+
+        private bool CheckStagingExists(FileInfo file)
+        {
+                
+
+            return true;
+        }
+
+        protected override void Reload(Filters<StagingSetout> criteria, Columns<StagingSetout> columns, ref SortOrder<StagingSetout>? sort, Action<CoreTable?, Exception?> action)
+        {
+            base.Reload(criteria, columns, ref sort, action);
+        }
+    }
+}