桌面端密炼计划、胶料快检调整

This commit is contained in:
2026-06-18 15:18:11 +08:00
parent 372dc10be2
commit c54d54b40f
20 changed files with 1509 additions and 311 deletions

View File

@@ -135,6 +135,42 @@ public class RubberQuickTestStdService : IRubberQuickTestStdService, ISingletonD
}
}
public Task<List<MesXslRubberQuickTestStd>> GetAllCachedAsync(CancellationToken ct = default)
{
ct.ThrowIfCancellationRequested();
lock (_cacheLock)
return Task.FromResult(_localCache.Select(CloneMain).ToList());
}
public Task<MesXslRubberQuickTestStd?> GetCachedByIdAsync(string id, CancellationToken ct = default)
{
ct.ThrowIfCancellationRequested();
if (string.IsNullOrWhiteSpace(id)) return Task.FromResult<MesXslRubberQuickTestStd?>(null);
lock (_cacheLock)
{
var found = _localCache.FirstOrDefault(x => string.Equals(x.Id, id, StringComparison.OrdinalIgnoreCase));
return Task.FromResult(found != null ? CloneMain(found) : null);
}
}
public async Task<MesXslRubberQuickTestStd?> GetWithLinesAsync(string id, CancellationToken ct = default)
{
if (string.IsNullOrWhiteSpace(id)) return null;
var cached = await GetCachedByIdAsync(id, ct).ConfigureAwait(false);
if (cached?.LineList is { Count: > 0 })
return cached;
if (_networkMonitor.IsOnline)
{
var detail = await GetByIdAsync(id, ct).ConfigureAwait(false);
if (detail != null)
return detail;
}
return cached;
}
public async Task<bool> SyncFromRemoteAsync(CancellationToken ct = default)
{
await _syncLock.WaitAsync(ct).ConfigureAwait(false);
@@ -309,6 +345,8 @@ public class RubberQuickTestStdService : IRubberQuickTestStdService, ISingletonD
StdName = x.StdName,
TestMethodId = x.TestMethodId,
TestMethodName = x.TestMethodName,
QuickTestTypeId = x.QuickTestTypeId,
QuickTestTypeName = x.QuickTestTypeName,
MixerType = x.MixerType,
RubberMaterialId = x.RubberMaterialId,
RubberMaterialName = x.RubberMaterialName,