mirror of
https://github.com/ajisaacs/OpenNest.git
synced 2026-10-27 06:01:06 -04:00
A release can now cover several sets, each with its own kit count, so parts
from different kits share sheets. It can also merge into an existing draft
nest instead of always creating one. Schema v9 replaces the single-set
release tables: releases, their set lines, their nests (created or merged,
with the nest revision before and after) and the drawing quantities each set
added to each nest, so a kit stays traceable once kits share a nest. The v8
migration turns each existing release into one set line with created nests.
Undo runs on the server in one transaction: created nests are soft-deleted
and merged nests restored to their pre-merge revision, but only while each
still holds what the release wrote. Otherwise nothing changes and the
changed nests are listed, so the operator can skip them. A nest restored to
that revision counts as unchanged, which lets releases sharing a nest be
undone newest first.
The old /api/sets/{id}/releases and /api/nests/{id}/release routes are
replaced by /api/releases; no tagged desktop used them. The desktop still
releases one set at a time until the release dialog is reworked.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
83 lines
2.9 KiB
C#
83 lines
2.9 KiB
C#
using OpenNest;
|
|
|
|
namespace OpenNest.Data;
|
|
|
|
/// <summary>How a release reached one of its nests.</summary>
|
|
public enum SetReleaseNestKind
|
|
{
|
|
/// <summary>The release uploaded the nest as new.</summary>
|
|
Created,
|
|
|
|
/// <summary>The release added its parts to an existing draft nest and renested it.</summary>
|
|
Merged,
|
|
}
|
|
|
|
/// <summary>What undoing the release did to one of its nests.</summary>
|
|
public enum SetReleaseNestUndo
|
|
{
|
|
/// <summary>A created nest was deleted (it can still be recovered).</summary>
|
|
Deleted,
|
|
|
|
/// <summary>A merged nest was restored to <see cref="SetReleaseNest.RevisionBefore"/>.</summary>
|
|
Restored,
|
|
|
|
/// <summary>The operator left the nest as it was, because it had changed since the release.</summary>
|
|
Skipped,
|
|
}
|
|
|
|
/// <summary>One nest of a release, the material group it was made for, and what the release put in it.</summary>
|
|
public sealed class SetReleaseNest
|
|
{
|
|
public Guid NestId { get; set; }
|
|
|
|
public SetReleaseNestKind Kind { get; set; } = SetReleaseNestKind.Created;
|
|
|
|
/// <summary>The draft's revision the release merged into; null for a created nest.</summary>
|
|
public int? RevisionBefore { get; set; }
|
|
|
|
/// <summary>The nest revision the release wrote. Undo acts only while the nest is still at it.</summary>
|
|
public int RevisionAfter { get; set; }
|
|
|
|
public string MaterialName { get; set; } = "";
|
|
|
|
public string MaterialGrade { get; set; } = "";
|
|
|
|
/// <summary>Thickness in <see cref="Units"/>, stored rounded to four decimals.</summary>
|
|
public double Thickness { get; set; }
|
|
|
|
public Units Units { get; set; } = Units.Inches;
|
|
|
|
public CutType CutType { get; set; } = CutType.Laser;
|
|
|
|
/// <summary>
|
|
/// The drawing quantities this release added to the nest, per set. Empty for releases
|
|
/// recorded before items were kept (schema v8).
|
|
/// </summary>
|
|
public IReadOnlyList<SetReleaseNestItem> Items { get; set; } = Array.Empty<SetReleaseNestItem>();
|
|
|
|
/// <summary>What undoing the release did to the nest; null while the release stands. Server-computed.</summary>
|
|
public SetReleaseNestUndo? Undo { get; set; }
|
|
|
|
/// <summary>The nest revision the undo wrote; null when it wrote none. Server-computed.</summary>
|
|
public int? UndoRevision { get; set; }
|
|
|
|
/// <summary>
|
|
/// The nest's current metadata, deleted or not, joined by the server when it reads a
|
|
/// release, so status and deletion are always up to date. Ignored on post.
|
|
/// </summary>
|
|
public NestRecord? Nest { get; set; }
|
|
}
|
|
|
|
/// <summary>A drawing quantity one set of a release added to one nest.</summary>
|
|
public sealed class SetReleaseNestItem
|
|
{
|
|
public Guid SetId { get; set; }
|
|
|
|
public Guid DrawingId { get; set; }
|
|
|
|
/// <summary>The library revision of the drawing that went into the nest.</summary>
|
|
public int DrawingRevision { get; set; }
|
|
|
|
public int Quantity { get; set; }
|
|
}
|