Bladeren bron

Cutting Group annotations now persist between setouts

frogsoftware 1 jaar geleden
bovenliggende
commit
dea1ba9067

+ 0 - 3
prs.desktop/PRSDesktop.csproj

@@ -770,9 +770,6 @@
             <DependentUpon>Resources.resx</DependentUpon>
             <DependentUpon>Resources.resx</DependentUpon>
         </Compile>
         </Compile>
         <Compile Remove="Panels\Schedule\**" />
         <Compile Remove="Panels\Schedule\**" />
-        <Compile Include="..\prs.stores\JobStatusStore.cs">
-          <Link>prs.stores\JobStatusStore.cs</Link>
-        </Compile>
 
 
     </ItemGroup>
     </ItemGroup>
 
 

+ 9 - 1
prs.desktop/Panels/Factory/FactoryPanel.xaml.cs

@@ -972,6 +972,12 @@ namespace PRSDesktop
                         documents = new Client<SetoutDocument>().Load(
                         documents = new Client<SetoutDocument>().Load(
                             new Filter<SetoutDocument>(x => x.EntityLink.ID).IsEqualTo(CurrentKanban.SetoutID));
                             new Filter<SetoutDocument>(x => x.EntityLink.ID).IsEqualTo(CurrentKanban.SetoutID));
                         foreach (var document in documents)
                         foreach (var document in documents)
+                        {
+                            // If this document is actually the cutting group document, 
+                            // redirect any annotations to the cutting group id rather than the setout
+                            if (document.EntityLink.Group.ID == packet.SetoutLink.Group.ID);
+                                document.ID = packet.SetoutLink.Group.ID;
+                            
                             if (document.DocumentLink != null && document.DocumentLink.FileName != null)
                             if (document.DocumentLink != null && document.DocumentLink.FileName != null)
                                 if (document.DocumentLink.FileName.ToLower().EndsWith(".pdf") ||
                                 if (document.DocumentLink.FileName.ToLower().EndsWith(".pdf") ||
                                     document.DocumentLink.FileName.ToLower().EndsWith(".png") ||
                                     document.DocumentLink.FileName.ToLower().EndsWith(".png") ||
@@ -986,9 +992,11 @@ namespace PRSDesktop
                                     pdfbtn.Click += ViewDrawing;
                                     pdfbtn.Click += ViewDrawing;
                                     ButtonStack.Children.Add(pdfbtn);
                                     ButtonStack.Children.Add(pdfbtn);
                                     if (document.Superceded.IsEmpty())
                                     if (document.Superceded.IsEmpty())
-                                        if ((PDFEditor != null && PDFEditor.Document.ID.Equals(document.ID)) || firstbutton == null)
+                                        if ((PDFEditor != null && PDFEditor.Document.ID.Equals(document.ID)) ||
+                                            firstbutton == null)
                                             firstbutton = pdfbtn;
                                             firstbutton = pdfbtn;
                                 }
                                 }
+                        }
 
 
                         if (firstbutton == null)
                         if (firstbutton == null)
                             firstbutton = qabtn;
                             firstbutton = qabtn;

+ 11 - 2
prs.desktop/Panels/Manufacturing/ManufacturingPanelColumn.xaml.cs

@@ -403,8 +403,17 @@ namespace PRSDesktop
                 var packet = Packets.Where(r => r.ID.ToString().Equals(model.ID)).FirstOrDefault();
                 var packet = Packets.Where(r => r.ID.ToString().Equals(model.ID)).FirstOrDefault();
 
 
                 var setoutid = packet.SetoutLink.ID;
                 var setoutid = packet.SetoutLink.ID;
-                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 table = new Client<SetoutDocument>().Query(
+                    new Filter<SetoutDocument>(x => x.EntityLink.ID).IsEqualTo(setoutid)
+                );
+                SetoutDocument[] docs = table.Rows.Select(r => r.ToObject<SetoutDocument>()).ToArray();
+
+                // If this document is actually the cutting group document, 
+                // redirect any annotations to the cutting group id rather than the setout
+                var sgdoc = docs.FirstOrDefault(x => x.EntityLink.Group.ID == packet.SetoutLink.Group.ID);
+                if (sgdoc != null)
+                    sgdoc.ID = packet.SetoutLink.Group.ID;
+                
                 var viewer = new DocumentEditor(docs);
                 var viewer = new DocumentEditor(docs);
                 viewer.ButtonsVisible = true;
                 viewer.ButtonsVisible = true;
                 //viewer.PrintAllowed = Security.IsAllowed<CanPrintFactoryFloorDrawings>();
                 //viewer.PrintAllowed = Security.IsAllowed<CanPrintFactoryFloorDrawings>();