修复BUG
This commit is contained in:
parent
e6aed9d06a
commit
3cff6c75db
@ -13,7 +13,7 @@ public class ReportExportService(
|
||||
ILogger<ReportExportService> 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<string> GetDirectoryAsync(DateTime? date = null)
|
||||
{
|
||||
var root = "D:\\码垛报告";
|
||||
var root = "D:\\码垛信息";
|
||||
if (date is null)
|
||||
date = DateTime.Now;
|
||||
// 构建文件夹路径,格式为 年/月/日
|
||||
|
@ -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();
|
||||
|
@ -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();
|
||||
|
Loading…
x
Reference in New Issue
Block a user