using YY.Admin.Core.Entity; namespace YY.Admin.Core.Services; public record RawMaterialEntryPageResult(List Records, long Total, int PageNo, int PageSize); public interface IRawMaterialEntryService { Task PageAsync( int pageNo, int pageSize, string? barcode = null, string? batchNo = null, string? billNo = null, string? materialName = null, string? supplierName = null, CancellationToken ct = default); Task GetByIdAsync(string id, CancellationToken ct = default); Task AddAsync(MesXslRawMaterialEntry entry, CancellationToken ct = default); Task EditAsync(MesXslRawMaterialEntry entry, CancellationToken ct = default); Task DeleteAsync(string id, CancellationToken ct = default); Task DeleteBatchAsync(string ids, CancellationToken ct = default); /// 生成条码/批次号(优先后端,离线回退本地;格式:QH+物料编码+yyMMdd+序号) Task GenerateBarcodeAsync(string materialCode, CancellationToken ct = default); /// 按业务打印绑定准备模板 JSON 与 printData(与后端 prepareNativePrint 一致,免密 anon)。 Task<(string templateJson, string printDataJson, string? errorMessage)> PrepareNativePrintAsync(string id, CancellationToken ct = default); /// /// 同步读取本地缓存的「全量入场记录」快照(深拷贝),不会触发远端拉取。 /// 主要用于「磅单已入场重量」等跨表实时聚合,且需要保持与后端相同口径的场景。 /// IReadOnlyList GetCachedSnapshot(); }