Files
meezi/src/Meezi.Core/Entities/Branch.cs
T
soroush.asadi 9e47a4e60c
CI/CD / CI · API (dotnet build + test) (push) Successful in 47s
CI/CD / CI · Admin API (dotnet build) (push) Successful in 30s
CI/CD / CI · Dashboard (tsc) (push) Successful in 1m9s
CI/CD / CI · Admin Web (tsc) (push) Successful in 38s
CI/CD / CI · Website (tsc) (push) Successful in 46s
CI/CD / CI · Koja (tsc) (push) Successful in 49s
CI/CD / Deploy · all services (push) Successful in 1m40s
feat(print): route print jobs through a local agent, fall back to TCP
Phase 2. NetworkPrinterService now builds the ESC/POS bytes (as before) and
dispatches them via a new router: if the receipt/kitchen/station printer is mapped
to a PrintDevice whose agent is online, the bytes are sent to that agent over the
hub and we await its ack; otherwise it falls back to a direct TCP connection (raw
IP), so existing on-prem/reachable printers keep working unchanged. Adds nullable
mapping columns Branch.ReceiptPrintDeviceId / KitchenPrintDeviceId and
KitchenStation.PrintDeviceId (additive migration), plus TestPrintDeviceAsync for
testing an agent printer. The cloud can now reach LAN/USB printers it never could.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-25 12:07:16 +03:30

51 lines
2.3 KiB
C#

namespace Meezi.Core.Entities;
/// <summary>Physical branch (شعبه) under a café tenant.</summary>
public class Branch : TenantEntity
{
public string Name { get; set; } = string.Empty;
public string? Address { get; set; }
public string? City { get; set; }
public string? Phone { get; set; }
public bool IsActive { get; set; } = true;
public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
/// <summary>When set with <see cref="BaseEntity.DeletedAt"/>, branch can be restored until this UTC time.</summary>
public DateTime? ScheduledPermanentDeleteAt { get; set; }
// Thermal printer (TCP ESC/POS)
public string? ReceiptPrinterIp { get; set; }
public int? ReceiptPrinterPort { get; set; }
public string? KitchenPrinterIp { get; set; }
public int? KitchenPrinterPort { get; set; }
/// <summary>Optional <see cref="PrintDevice"/> to route through a local print agent
/// (preferred over the raw IP when its agent is online). Cloud-hosted cafés use this.</summary>
public string? ReceiptPrintDeviceId { get; set; }
public string? KitchenPrintDeviceId { get; set; }
public int PaperWidthMm { get; set; } = 80;
public bool AutoCutEnabled { get; set; } = true;
public string? ReceiptHeader { get; set; }
public string? ReceiptFooter { get; set; }
public string? WifiPassword { get; set; }
/// <summary>Branch-specific logo on QR guest menu (falls back to café logo).</summary>
public string? LogoUrl { get; set; }
public string? WelcomeText { get; set; }
public string? AccentColor { get; set; }
/// <summary>Branch tax % when café <see cref="Cafe.AllowBranchTaxOverride"/> is true.</summary>
public decimal? TaxRate { get; set; }
// Card POS terminal (HTTP bridge on local network)
public string? PosDeviceIp { get; set; }
public int? PosDevicePort { get; set; }
public Cafe Cafe { get; set; } = null!;
public ICollection<TableSection> Sections { get; set; } = [];
public ICollection<Table> Tables { get; set; } = [];
public ICollection<Order> Orders { get; set; } = [];
public ICollection<Employee> Staff { get; set; } = [];
/// <summary>Per-branch role assignments scoped to this branch.</summary>
public ICollection<EmployeeBranchRole> StaffRoles { get; set; } = [];
}