瀏覽代碼

Changed requisition lookup to popup editor

Kenric Nugteren 1 年之前
父節點
當前提交
bfa66b2293

+ 1 - 1
prs.classes/Entities/Requisition/RequisitionLink.cs

@@ -5,7 +5,7 @@ namespace Comal.Classes
 {
     public class RequisitionLink : EntityLink<Requisition>, IRequisition
     {
-        [LookupEditor(typeof(Requisition))]
+        [PopupEditor(typeof(Requisition))]
         public override Guid ID { get; set; }
 
         [IntegerEditor(Editable = Editable.Hidden)]

+ 19 - 12
prs.desktop/Panels/DeliveredOnSite/DeliveredOnSiteGrid.cs

@@ -7,6 +7,7 @@ using Comal.Classes;
 using InABox.Clients;
 using InABox.Core;
 using InABox.DynamicGrid;
+using InABox.Wpf;
 using InABox.WPF;
 
 namespace PRSDesktop
@@ -40,7 +41,6 @@ namespace PRSDesktop
             HiddenColumns.Add(x => x.ManufacturingPacketLink.ID);
             HiddenColumns.Add(x => x.ManufacturingPacketLink.WaterMark);
             HiddenColumns.Add(x => x.ManufacturingPacketLink.SetoutLink.ID);
-            HiddenColumns.Add(x => x.ManufacturingPacketLink.SetoutLink.Deleted);
         }
 
         protected override void DoReconfigure(FluentList<DynamicGridOption> options)
@@ -68,33 +68,40 @@ namespace PRSDesktop
 
         public Job Job { get; set; }
 
-        private BitmapImage? SetoutImage(CoreRow arg)
+        private BitmapImage? SetoutImage(CoreRow? arg)
         {
             if (arg == null)
                 return null;
             return arg.IsEntityLinkValid<DeliveryItem, SetoutLink>(x => x.ManufacturingPacketLink.SetoutLink) ? setout : null;
         }
 
-        private bool SetoutClick(CoreRow arg)
+        private bool SetoutClick(CoreRow? arg)
         {
             if (arg == null)
                 return false;
             var setoutid = arg.EntityLinkID<DeliveryItem, SetoutLink>(x => x.ManufacturingPacketLink.SetoutLink) ?? Guid.Empty;
             if (setoutid != Guid.Empty)
             {
-                var table = new Client<SetoutDocument>().Query(new Filter<SetoutDocument>(x => x.EntityLink.ID).IsEqualTo(setoutid));
-                IEntityDocument[] docs = table.Rows.Select(r => r.ToObject<SetoutDocument>()).ToArray();
-                var viewer = new DocumentEditor(docs);
-                //viewer.PrintAllowed = Security.IsAllowed<CanPrintFactoryFloorDrawings>();
-                viewer.SaveAllowed = Security.IsAllowed<CanSaveFactoryFloorDrawings>();
-                viewer.Watermark = arg.Get<DeliveryItem, string>(x => x.ManufacturingPacketLink.WaterMark);
-                viewer.ShowDialog();
+                var docs = new Client<SetoutDocument>().Query(new Filter<SetoutDocument>(x => x.EntityLink.ID).IsEqualTo(setoutid))
+                    .ToArray<SetoutDocument>();
+                if(docs.Length == 0)
+                {
+                    MessageWindow.ShowMessage("The setout linked to this delivery has no documents.", "No documents");
+                }
+                else
+                {
+                    var viewer = new DocumentEditor(docs);
+                    //viewer.PrintAllowed = Security.IsAllowed<CanPrintFactoryFloorDrawings>();
+                    viewer.SaveAllowed = Security.IsAllowed<CanSaveFactoryFloorDrawings>();
+                    viewer.Watermark = arg.Get<DeliveryItem, string>(x => x.ManufacturingPacketLink.WaterMark);
+                    viewer.ShowDialog();
+                }
             }
 
             return false;
         }
 
-        private bool DocumentsClick(CoreRow arg)
+        private bool DocumentsClick(CoreRow? arg)
         {
             if (arg == null)
                 return false;
@@ -125,7 +132,7 @@ namespace PRSDesktop
             return false;
         }
 
-        private BitmapImage DocumentsImage(CoreRow arg)
+        private BitmapImage DocumentsImage(CoreRow? arg)
         {
             if (arg == null)
                 return docs;