feat(menu): per-item print station (cold bar / kitchen / barista)
CI/CD / CI · API (dotnet build + test) (push) Successful in 41s
CI/CD / CI · Admin API (dotnet build) (push) Successful in 29s
CI/CD / CI · Dashboard (tsc) (push) Successful in 1m6s
CI/CD / CI · Admin Web (tsc) (push) Successful in 38s
CI/CD / CI · Website (tsc) (push) Successful in 45s
CI/CD / CI · Koja (tsc) (push) Successful in 49s
CI/CD / Deploy · all services (push) Successful in 3m28s
CI/CD / CI · API (dotnet build + test) (push) Successful in 41s
CI/CD / CI · Admin API (dotnet build) (push) Successful in 29s
CI/CD / CI · Dashboard (tsc) (push) Successful in 1m6s
CI/CD / CI · Admin Web (tsc) (push) Successful in 38s
CI/CD / CI · Website (tsc) (push) Successful in 45s
CI/CD / CI · Koja (tsc) (push) Successful in 49s
CI/CD / Deploy · all services (push) Successful in 3m28s
Each menu item can now pick its own print station, overriding the category's — so a category can fan out to different printers (e.g. a drink → cold bar, a food → kitchen). Adds MenuItem.KitchenStationId (+ migration, FK SetNull), wires create/update/DTO, and updates kitchen-ticket routing to group by the item's station ?? the category's station ?? the branch kitchen printer. Deleting a station now also clears item assignments. Menu item editor gains a "Print station" dropdown (default = "same as category"). fa/en/ar added. Backend built clean via the Nexus mirror; migration applies on deploy (MigrateAsync). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -114,6 +114,12 @@ public class KitchenStationService : IKitchenStationService
|
||||
foreach (var cat in categories)
|
||||
cat.KitchenStationId = null;
|
||||
|
||||
var items = await _db.MenuItems
|
||||
.Where(i => i.KitchenStationId == id && i.CafeId == cafeId)
|
||||
.ToListAsync(ct);
|
||||
foreach (var item in items)
|
||||
item.KitchenStationId = null;
|
||||
|
||||
entity.DeletedAt = DateTime.UtcNow;
|
||||
await _db.SaveChangesAsync(ct);
|
||||
return true;
|
||||
|
||||
@@ -139,7 +139,8 @@ public class MenuService : IMenuService
|
||||
ImageUrl = imageUrl,
|
||||
VideoUrl = request.VideoUrl,
|
||||
Model3dUrl = NormalizeOptionalText(request.Model3dUrl),
|
||||
IsAvailable = request.IsAvailable
|
||||
IsAvailable = request.IsAvailable,
|
||||
KitchenStationId = string.IsNullOrWhiteSpace(request.KitchenStationId) ? null : request.KitchenStationId,
|
||||
};
|
||||
|
||||
_db.MenuItems.Add(entity);
|
||||
@@ -178,6 +179,8 @@ public class MenuService : IMenuService
|
||||
if (request.Model3dUrl is not null)
|
||||
entity.Model3dUrl = string.IsNullOrWhiteSpace(request.Model3dUrl) ? null : request.Model3dUrl.Trim();
|
||||
if (request.IsAvailable.HasValue) entity.IsAvailable = request.IsAvailable.Value;
|
||||
if (request.KitchenStationId is not null)
|
||||
entity.KitchenStationId = string.IsNullOrWhiteSpace(request.KitchenStationId) ? null : request.KitchenStationId;
|
||||
|
||||
await _db.SaveChangesAsync(cancellationToken);
|
||||
return ToItemDto(entity);
|
||||
@@ -236,5 +239,6 @@ public class MenuService : IMenuService
|
||||
MenuItemImageDefaults.ResolveDisplayImageUrl(i),
|
||||
i.VideoUrl,
|
||||
i.Model3dUrl,
|
||||
i.IsAvailable);
|
||||
i.IsAvailable,
|
||||
i.KitchenStationId);
|
||||
}
|
||||
|
||||
@@ -76,15 +76,16 @@ public class NetworkPrinterService : IPrinterService
|
||||
return PrintResult.Ok();
|
||||
|
||||
var menuItemIds = activeItems.Select(i => i.MenuItemId).Distinct().ToList();
|
||||
var categoryStations = await (
|
||||
// Per-item station overrides the category's station; fall back to category.
|
||||
var itemStations = await (
|
||||
from m in _db.MenuItems.AsNoTracking()
|
||||
join c in _db.MenuCategories.AsNoTracking() on m.CategoryId equals c.Id
|
||||
where menuItemIds.Contains(m.Id) && m.CafeId == cafeId
|
||||
select new { m.Id, c.KitchenStationId }
|
||||
select new { m.Id, StationId = m.KitchenStationId ?? c.KitchenStationId }
|
||||
).ToListAsync(ct);
|
||||
|
||||
var stationIds = categoryStations
|
||||
.Select(x => x.KitchenStationId)
|
||||
var stationIds = itemStations
|
||||
.Select(x => x.StationId)
|
||||
.Where(id => !string.IsNullOrEmpty(id))
|
||||
.Distinct()
|
||||
.ToList();
|
||||
@@ -99,8 +100,8 @@ public class NetworkPrinterService : IPrinterService
|
||||
var groups = activeItems
|
||||
.GroupBy(item =>
|
||||
{
|
||||
var cat = categoryStations.FirstOrDefault(c => c.Id == item.MenuItemId);
|
||||
return cat?.KitchenStationId;
|
||||
var map = itemStations.FirstOrDefault(c => c.Id == item.MenuItemId);
|
||||
return map?.StationId;
|
||||
})
|
||||
.ToList();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user