From 9bf40e384963a12e3b3465d2b2b3559284998e72 Mon Sep 17 00:00:00 2001 From: anerx <512464164@qq.com> Date: Sun, 23 Mar 2025 16:46:57 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8DBUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Seyounth.Hyosung.Data/Services/TrayService.cs | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/Seyounth.Hyosung.Data/Services/TrayService.cs b/Seyounth.Hyosung.Data/Services/TrayService.cs index fba7ae7..a86e9a5 100644 --- a/Seyounth.Hyosung.Data/Services/TrayService.cs +++ b/Seyounth.Hyosung.Data/Services/TrayService.cs @@ -115,24 +115,26 @@ public class TrayService : ITrayService public Task ExportedAsync(string trayCode) { - var tray = _db.CopyNew().Queryable().Where(d => d.TrayCode == trayCode).First(); - tray.Exported = true; - return _db.CopyNew().Updateable(tray).ExecuteCommandAsync(); + return _db.CopyNew().Updateable() + .Where(x => x.TrayCode == trayCode) + .SetColumns(x => x.Exported, true).ExecuteCommandAsync(); } - public Task> GetNoExportCodesAsync() + public async Task> GetNoExportCodesAsync() { - var tray = _db.CopyNew().Queryable().Where(x => x.Exported != true && x.FinishTime != null) - .ToList(); + var tray = await _db.CopyNew().Queryable().Where(x => x.Exported != true && x.FinishTime != null) + .ToListAsync(); var trayCodes = tray.Select(x => x.TrayCode).ToList(); - return Task.FromResult(trayCodes); + return trayCodes; } public Task SetControlNoAsync(string trayCode, int controlNo) { - var tray = _db.CopyNew().Queryable().Where(d => d.TrayCode == trayCode).First(); - tray.ControlNo = controlNo; - return _db.CopyNew().Updateable(tray).ExecuteCommandAsync(); + return _db.CopyNew() + .Updateable() + .Where(d => d.TrayCode == trayCode) + .SetColumns(x => x.ControlNo, controlNo) + .ExecuteCommandAsync(); } public async Task GetIsPacking()