From 3cff6c75db5fd22730479aa5f3a21ded8ad4abb2 Mon Sep 17 00:00:00 2001 From: zhangzhuo <512464164@qq.com> Date: Mon, 24 Mar 2025 14:30:14 +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 --- .../Services/ReportExportService.cs | 14 ++++++++------ Seyounth.Hyosung.Runtime/HyosungRuntime.cs | 4 ++-- Seyounth.Hyosung/App.xaml.cs | 2 ++ 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/Seyounth.Hyosung.Data/Services/ReportExportService.cs b/Seyounth.Hyosung.Data/Services/ReportExportService.cs index 5f7d88c..eee4571 100644 --- a/Seyounth.Hyosung.Data/Services/ReportExportService.cs +++ b/Seyounth.Hyosung.Data/Services/ReportExportService.cs @@ -13,7 +13,7 @@ public class ReportExportService( ILogger logger) : IReportExportService { - const string TempPath = "./temp.xlsx"; + const string TempPath = "./exportTemp.xlsx"; public async Task ExportAsync(string trayCode) { @@ -55,9 +55,10 @@ public class ReportExportService( worksheet.Cell(row, "B").Value = i; // 填充 YarnId 到第一列 worksheet.Cell(row, "C").Value = yarns[i - 1].Lot; // 填充 YarnName 到第二列 worksheet.Cell(row, "D").Value = variety.Code; // 填充 YarnName 到第二列 - worksheet.Cell(row, "F").Value = yarns[i - 1].WorkShift; - worksheet.Cell(row, "H").Value = yarns[i - 1].QrCode; - worksheet.Cell(row, "p").Value = yarns[i - 1].StackTime?.ToString("yyyy-MM-dd HH:mm:ss"); + worksheet.Cell(row, "F").Value = yarns[i - 1].Machine; + worksheet.Cell(row, "H").Value = yarns[i - 1].WorkShift; + worksheet.Cell(row, "I").Value = yarns[i - 1].QrCode; + worksheet.Cell(row, "P").Value = yarns[i - 1].StackTime?.ToString("yyyy-MM-dd HH:mm:ss"); row++; } @@ -67,10 +68,11 @@ public class ReportExportService( var dataRange = worksheet.Range(8, 2, row, 18); // 设置外边框样式 dataRange.Style.Border.OutsideBorder = XLBorderStyleValues.Thick; + dataRange.Style.Border.InsideBorder = XLBorderStyleValues.Medium; dataRange.Style.Border.OutsideBorderColor = XLColor.Black; var path = await GetDirectoryAsync(tray.FinishTime); var fileName = - $"{variety.Id}-{variety.Code}-{tray.TrayCode}-{tray.FinishTime?.ToString("yyyyMMddHHmmss")}.xlsx"; + $"{variety.Lot}-{tray.TrayCode}-{tray.FinishTime?.ToString("yyyyMMddHHmmss")}.xlsx"; var filePath = Path.Combine(path, fileName); // 保存工作簿到新文件 workbook.SaveAs(filePath); @@ -94,7 +96,7 @@ public class ReportExportService( public async Task GetDirectoryAsync(DateTime? date = null) { - var root = "D:\\码垛报告"; + var root = "D:\\码垛信息"; if (date is null) date = DateTime.Now; // 构建文件夹路径,格式为 年/月/日 diff --git a/Seyounth.Hyosung.Runtime/HyosungRuntime.cs b/Seyounth.Hyosung.Runtime/HyosungRuntime.cs index 5b31baa..bd62a7c 100644 --- a/Seyounth.Hyosung.Runtime/HyosungRuntime.cs +++ b/Seyounth.Hyosung.Runtime/HyosungRuntime.cs @@ -38,7 +38,7 @@ public class HyosungRuntime( public async Task StartAsync(CancellationToken token) { - //reportExportService.ExportNoExportAsync(); + reportExportService.ExportNoExportAsync(); //启动扫码服务 await hyosungScannerService.StartAsync(token); await printer.StartAsync(token); @@ -194,7 +194,7 @@ public class HyosungRuntime( try { await trayService.StorageAsync(info.TrayCode); - reportExportService.ExportAsync(info.TrayCode); + //reportExportService.ExportAsync(info.TrayCode); await hyosungAgvService.StorageAsync(info.TrayCode); //标志下线已完成 await hyosungPlcService.LeaveCompletedAsync(); diff --git a/Seyounth.Hyosung/App.xaml.cs b/Seyounth.Hyosung/App.xaml.cs index 222115e..1a0f884 100644 --- a/Seyounth.Hyosung/App.xaml.cs +++ b/Seyounth.Hyosung/App.xaml.cs @@ -5,6 +5,7 @@ using System.Reflection; using System.Runtime.InteropServices; using System.Text; using System.Windows; +using System.Windows.Media; using System.Windows.Threading; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; @@ -30,6 +31,7 @@ public partial class App : Application public App() { + RenderOptions.ProcessRenderMode = System.Windows.Interop.RenderMode.Default; var builder = Host .CreateApplicationBuilder(); builder.Logging.ClearProviders();