提交报表导出 以及ControlNoBUG
This commit is contained in:
parent
981b007d4a
commit
bff53544d8
@ -14,7 +14,7 @@ public class TrayEntity
|
|||||||
[SugarColumn(ColumnDescription = "所属的品类信息")]
|
[SugarColumn(ColumnDescription = "所属的品类信息")]
|
||||||
public int VarietyId { get; set; }
|
public int VarietyId { get; set; }
|
||||||
|
|
||||||
[SugarColumn(ColumnDescription = "垛高",IsNullable =true)]
|
[SugarColumn(ColumnDescription = "垛高", IsNullable = true)]
|
||||||
public int? StackHeight { get; set; }
|
public int? StackHeight { get; set; }
|
||||||
|
|
||||||
[SugarColumn(ColumnDescription = "是否为双号")]
|
[SugarColumn(ColumnDescription = "是否为双号")]
|
||||||
@ -44,4 +44,6 @@ public class TrayEntity
|
|||||||
[SugarColumn(IsNullable = true)] public string? Barcode { get; set; }
|
[SugarColumn(IsNullable = true)] public string? Barcode { get; set; }
|
||||||
|
|
||||||
[SugarColumn(IsNullable = true)] public bool? IsPacking { get; set; } = false;
|
[SugarColumn(IsNullable = true)] public bool? IsPacking { get; set; } = false;
|
||||||
|
|
||||||
|
[SugarColumn(IsNullable = true)] public bool? Exported { get; set; }
|
||||||
}
|
}
|
@ -40,6 +40,8 @@ public class Tray
|
|||||||
|
|
||||||
public bool? IsPacking { get; set; }
|
public bool? IsPacking { get; set; }
|
||||||
|
|
||||||
|
public bool? Exported { get; set; }
|
||||||
|
|
||||||
public TrayEntity ToEntity()
|
public TrayEntity ToEntity()
|
||||||
{
|
{
|
||||||
return new TrayEntity()
|
return new TrayEntity()
|
||||||
@ -61,7 +63,8 @@ public class Tray
|
|||||||
Unit = Unit,
|
Unit = Unit,
|
||||||
AgvBinId = AgvBinId,
|
AgvBinId = AgvBinId,
|
||||||
Barcode = Barcode,
|
Barcode = Barcode,
|
||||||
IsPacking= IsPacking
|
IsPacking = IsPacking,
|
||||||
|
Exported = Exported
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,7 +89,8 @@ public class Tray
|
|||||||
Unit = entity.Unit,
|
Unit = entity.Unit,
|
||||||
AgvBinId = entity.AgvBinId,
|
AgvBinId = entity.AgvBinId,
|
||||||
Barcode = entity.Barcode,
|
Barcode = entity.Barcode,
|
||||||
IsPacking=entity.IsPacking
|
IsPacking = entity.IsPacking,
|
||||||
|
Exported = entity.Exported
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -44,6 +44,7 @@ public static class ServiceExtensions
|
|||||||
services.AddSingleton<IDictService, DictService>();
|
services.AddSingleton<IDictService, DictService>();
|
||||||
services.AddSingleton<IHyosungWmsService, HyosungWmsService>();
|
services.AddSingleton<IHyosungWmsService, HyosungWmsService>();
|
||||||
services.AddSingleton<IPalletService, PalletService>();
|
services.AddSingleton<IPalletService, PalletService>();
|
||||||
|
services.AddSingleton<IReportExportService, ReportExportService>();
|
||||||
return services;
|
return services;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
9
Seyounth.Hyosung.Data/Services/IReportExportService.cs
Normal file
9
Seyounth.Hyosung.Data/Services/IReportExportService.cs
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
namespace Seyounth.Hyosung.Data.Services;
|
||||||
|
|
||||||
|
public interface IReportExportService
|
||||||
|
{
|
||||||
|
Task ExportAsync(string trayCode);
|
||||||
|
|
||||||
|
|
||||||
|
Task ExportNoExportAsync();
|
||||||
|
}
|
@ -44,7 +44,14 @@ public interface ITrayService
|
|||||||
/// <param name="controlNo"></param>
|
/// <param name="controlNo"></param>
|
||||||
/// <param name="itemInfo"></param>
|
/// <param name="itemInfo"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<Tray> PrintTrayAsync(string trayCode, int controlNo, MST_ITEM_2240_V itemInfo);
|
Task<Tray> PrintTrayAsync(string trayCode, MST_ITEM_2240_V itemInfo);
|
||||||
|
|
||||||
Task UpdateHeightAsync(string trayCode, int height);
|
Task UpdateHeightAsync(string trayCode, int height);
|
||||||
|
|
||||||
|
|
||||||
|
Task ExportedAsync(string trayCode);
|
||||||
|
|
||||||
|
Task<List<string>> GetNoExportCodesAsync();
|
||||||
|
|
||||||
|
Task SetControlNoAsync(string trayCode, int controlNo);
|
||||||
}
|
}
|
89
Seyounth.Hyosung.Data/Services/ReportExportService.cs
Normal file
89
Seyounth.Hyosung.Data/Services/ReportExportService.cs
Normal file
@ -0,0 +1,89 @@
|
|||||||
|
using System.Data;
|
||||||
|
using ClosedXML.Excel;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
|
namespace Seyounth.Hyosung.Data.Services;
|
||||||
|
|
||||||
|
public class ReportExportService(
|
||||||
|
IYarnService yarnService,
|
||||||
|
IVarietyService varietyService,
|
||||||
|
ITrayService trayService,
|
||||||
|
ILogger<ReportExportService> logger)
|
||||||
|
: IReportExportService
|
||||||
|
{
|
||||||
|
public async Task ExportAsync(string trayCode)
|
||||||
|
{
|
||||||
|
var tray = await trayService.GetByCode(trayCode);
|
||||||
|
var variety = await varietyService.GetById(tray.VarietyId);
|
||||||
|
var yarns = await yarnService.GetYarnsByTrayIdAsync(tray.Id);
|
||||||
|
DataTable dt = new DataTable();
|
||||||
|
dt.Columns.Add("托盘号", typeof(string));
|
||||||
|
dt.Columns.Add("品类编号", typeof(string));
|
||||||
|
dt.Columns.Add("品类", typeof(string));
|
||||||
|
dt.Columns.Add("Lot", typeof(string));
|
||||||
|
dt.Columns.Add("纱二维码", typeof(string));
|
||||||
|
dt.Columns.Add("DEN_FILA", typeof(string));
|
||||||
|
dt.Columns.Add("DTEX_FILA", typeof(string));
|
||||||
|
dt.Columns.Add("码垛时间", typeof(string));
|
||||||
|
dt.Columns.Add("控制号", typeof(string));
|
||||||
|
foreach (var yarn in yarns)
|
||||||
|
{
|
||||||
|
dt.Rows.Add(
|
||||||
|
tray.TrayCode,
|
||||||
|
variety.Id.ToString(),
|
||||||
|
variety.Code,
|
||||||
|
yarn.Lot.ToString(),
|
||||||
|
yarn.QrCode.Replace("\r\n", " "),
|
||||||
|
yarn.DenFila,
|
||||||
|
yarn.DtexFila,
|
||||||
|
yarn.StackTime?.ToString("yyyy-MM-dd HH:mm:ss"),
|
||||||
|
tray.ControlNo.ToString()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
var path = await GetDirectoryAsync(tray.FinishTime);
|
||||||
|
var fileName =
|
||||||
|
$"{variety.Id}-{variety.Code}-{tray.TrayCode}-{tray.FinishTime?.ToString("yyyyMMddHHmmss")}.xlsx";
|
||||||
|
var filePath = Path.Combine(path, fileName);
|
||||||
|
using var workbook = new XLWorkbook();
|
||||||
|
var worksheet = workbook.Worksheets.Add(dt, "纱信息");
|
||||||
|
worksheet.Columns().AdjustToContents();
|
||||||
|
workbook.SaveAs(filePath);
|
||||||
|
await trayService.ExportedAsync(tray.TrayCode);
|
||||||
|
logger.LogInformation($"export report [{tray.TrayCode}]:{filePath}");
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task ExportNoExportAsync()
|
||||||
|
{
|
||||||
|
var codes = await trayService.GetNoExportCodesAsync();
|
||||||
|
codes.ForEach(async void (code) =>
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
await ExportAsync(code);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
logger.LogError(e, $"export report [{code}] error");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<string> GetDirectoryAsync(DateTime? date = null)
|
||||||
|
{
|
||||||
|
if (date is null)
|
||||||
|
date = DateTime.Now;
|
||||||
|
// 构建文件夹路径,格式为 年/月/日
|
||||||
|
string directoryPath = Path.Combine(date.Value.Year.ToString(), date.Value.Month.ToString(),
|
||||||
|
date.Value.Day.ToString());
|
||||||
|
|
||||||
|
// 检查文件夹是否存在
|
||||||
|
if (!Directory.Exists(directoryPath))
|
||||||
|
{
|
||||||
|
// 如果不存在,则创建文件夹
|
||||||
|
await Task.Run(() => Directory.CreateDirectory(directoryPath));
|
||||||
|
}
|
||||||
|
|
||||||
|
return directoryPath;
|
||||||
|
}
|
||||||
|
}
|
@ -13,17 +13,17 @@ namespace Seyounth.Hyosung.Data.Services;
|
|||||||
public class TrayService : ITrayService
|
public class TrayService : ITrayService
|
||||||
{
|
{
|
||||||
//private readonly ConcurrentDictionary<string, Tray> _cache = new();
|
//private readonly ConcurrentDictionary<string, Tray> _cache = new();
|
||||||
// private readonly <TrayEntity> _repository;
|
// private readonly <TrayEntity> _repository;
|
||||||
private readonly IHyosungWmsService _hyosungWmsService;
|
private readonly IHyosungWmsService _hyosungWmsService;
|
||||||
|
|
||||||
private readonly ISqlSugarClient _db;
|
private readonly ISqlSugarClient _db;
|
||||||
|
|
||||||
public TrayService(IServiceProvider provider, IHyosungWmsService hyosungWmsService,ISqlSugarClient db)
|
public TrayService(IServiceProvider provider, IHyosungWmsService hyosungWmsService, ISqlSugarClient db)
|
||||||
{
|
{
|
||||||
_db = db;
|
_db = db;
|
||||||
// _repository = provider.CreateScope().ServiceProvider.GetRequiredService<IRepository<TrayEntity>>();
|
// _repository = provider.CreateScope().ServiceProvider.GetRequiredService<IRepository<TrayEntity>>();
|
||||||
//_repository = provider.GetService<IRepository<TrayEntity>>();
|
//_repository = provider.GetService<IRepository<TrayEntity>>();
|
||||||
// var trays = _db.Queryable<TrayEntity>().Where(t => t.ControlNo == null).ToListAsync().Result;
|
// var trays = _db.Queryable<TrayEntity>().Where(t => t.ControlNo == null).ToListAsync().Result;
|
||||||
_hyosungWmsService = hyosungWmsService;
|
_hyosungWmsService = hyosungWmsService;
|
||||||
//foreach (var tray in trays)
|
//foreach (var tray in trays)
|
||||||
//{
|
//{
|
||||||
@ -43,7 +43,7 @@ public class TrayService : ITrayService
|
|||||||
tray.IsEven = count % 2 == 0;
|
tray.IsEven = count % 2 == 0;
|
||||||
var identity = await _db.CopyNew().Insertable<TrayEntity>(tray.ToEntity()).ExecuteReturnIdentityAsync();
|
var identity = await _db.CopyNew().Insertable<TrayEntity>(tray.ToEntity()).ExecuteReturnIdentityAsync();
|
||||||
tray.Id = identity;
|
tray.Id = identity;
|
||||||
// _cache.TryAdd(tray.TrayCode, tray);
|
// _cache.TryAdd(tray.TrayCode, tray);
|
||||||
return tray;
|
return tray;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -55,8 +55,8 @@ public class TrayService : ITrayService
|
|||||||
//}
|
//}
|
||||||
//catch
|
//catch
|
||||||
//{
|
//{
|
||||||
return (await _db.CopyNew().Queryable<TrayEntity>().Where(d => d.TrayCode == code).FirstAsync()).Id;
|
return (await _db.CopyNew().Queryable<TrayEntity>().Where(d => d.TrayCode == code).FirstAsync()).Id;
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<Tray> GetByCode(string code)
|
public async Task<Tray> GetByCode(string code)
|
||||||
@ -69,7 +69,7 @@ public class TrayService : ITrayService
|
|||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<Tray> PrintTrayAsync(string trayCode, int controlNo, MST_ITEM_2240_V itemInfo)
|
public async Task<Tray> PrintTrayAsync(string trayCode, MST_ITEM_2240_V itemInfo)
|
||||||
{
|
{
|
||||||
Tray tray;
|
Tray tray;
|
||||||
//try
|
//try
|
||||||
@ -78,10 +78,9 @@ public class TrayService : ITrayService
|
|||||||
//}
|
//}
|
||||||
//catch
|
//catch
|
||||||
//{
|
//{
|
||||||
tray = await GetByCode(trayCode);
|
tray = await GetByCode(trayCode);
|
||||||
//}
|
//}
|
||||||
|
|
||||||
tray.ControlNo = controlNo;
|
|
||||||
tray.Grade = itemInfo.GRADE;
|
tray.Grade = itemInfo.GRADE;
|
||||||
tray.Type = itemInfo.TYPE;
|
tray.Type = itemInfo.TYPE;
|
||||||
tray.DenFila = itemInfo.DEN_FILA;
|
tray.DenFila = itemInfo.DEN_FILA;
|
||||||
@ -90,19 +89,19 @@ public class TrayService : ITrayService
|
|||||||
tray.NetWeight = itemInfo.NET_WEIGHT;
|
tray.NetWeight = itemInfo.NET_WEIGHT;
|
||||||
tray.GrossWeight = itemInfo.GROSS_WEIGHT;
|
tray.GrossWeight = itemInfo.GROSS_WEIGHT;
|
||||||
tray.Barcode =
|
tray.Barcode =
|
||||||
$"{itemInfo.ITEM_CODE} {DateTime.Now:yyMMdd}00{itemInfo.LOTNO.PadLeft(4, '0')}{controlNo.ToString().PadLeft(4, '0')}0";
|
$"{itemInfo.ITEM_CODE} {DateTime.Now:yyMMdd}00{itemInfo.LOTNO.PadLeft(4, '0')}{tray.ControlNo?.ToString().PadLeft(4, '0')}0";
|
||||||
await _db.Updateable<TrayEntity>(tray.ToEntity()).ExecuteCommandAsync();
|
await _db.Updateable<TrayEntity>(tray.ToEntity()).ExecuteCommandAsync();
|
||||||
// _cache.Remove(tray.TrayCode, out _);
|
// _cache.Remove(tray.TrayCode, out _);
|
||||||
return tray;
|
return tray;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task StorageAsync(string trayCode)
|
public async Task StorageAsync(string trayCode)
|
||||||
{
|
{
|
||||||
var tray = await _db.CopyNew().Queryable<TrayEntity>().Where(d => d.TrayCode == trayCode).FirstAsync();
|
var tray = await _db.CopyNew().Queryable<TrayEntity>().Where(d => d.TrayCode == trayCode).FirstAsync();
|
||||||
tray.FinishTime = DateTime.Now;
|
tray.FinishTime = DateTime.Now;
|
||||||
tray.IsPacking = true;
|
tray.IsPacking = true;
|
||||||
await _db.CopyNew().Updateable<TrayEntity>(tray).ExecuteCommandAsync();
|
await _db.CopyNew().Updateable<TrayEntity>(tray).ExecuteCommandAsync();
|
||||||
// _cache.TryRemove(tray.TrayCode, out _);
|
// _cache.TryRemove(tray.TrayCode, out _);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task UpdateHeightAsync(string trayCode, int height)
|
public async Task UpdateHeightAsync(string trayCode, int height)
|
||||||
@ -114,9 +113,32 @@ public class TrayService : ITrayService
|
|||||||
.ExecuteCommandAsync();
|
.ExecuteCommandAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Task ExportedAsync(string trayCode)
|
||||||
|
{
|
||||||
|
var tray = _db.CopyNew().Queryable<TrayEntity>().Where(d => d.TrayCode == trayCode).First();
|
||||||
|
tray.Exported = true;
|
||||||
|
return _db.CopyNew().Updateable(tray).ExecuteCommandAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Task<List<string>> GetNoExportCodesAsync()
|
||||||
|
{
|
||||||
|
var tray = _db.CopyNew().Queryable<TrayEntity>().Where(x => x.Exported != true && x.FinishTime != null)
|
||||||
|
.ToList();
|
||||||
|
var trayCodes = tray.Select(x => x.TrayCode).ToList();
|
||||||
|
return Task.FromResult(trayCodes);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Task SetControlNoAsync(string trayCode, int controlNo)
|
||||||
|
{
|
||||||
|
var tray = _db.CopyNew().Queryable<TrayEntity>().Where(d => d.TrayCode == trayCode).First();
|
||||||
|
tray.ControlNo = controlNo;
|
||||||
|
return _db.CopyNew().Updateable(tray).ExecuteCommandAsync();
|
||||||
|
}
|
||||||
|
|
||||||
public async Task<Tray> GetIsPacking()
|
public async Task<Tray> GetIsPacking()
|
||||||
{
|
{
|
||||||
var tray= await _db.CopyNew().Queryable<TrayEntity>().Where(x => x.IsPacking!=null&&x.IsPacking.Value).FirstAsync();
|
var tray = await _db.CopyNew().Queryable<TrayEntity>().Where(x => x.IsPacking != null && x.IsPacking.Value)
|
||||||
|
.FirstAsync();
|
||||||
return Tray.FromEntity(tray);
|
return Tray.FromEntity(tray);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -7,10 +7,12 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<PackageReference Include="ClosedXML" Version="0.104.2" />
|
||||||
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.0" />
|
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.0" />
|
||||||
<PackageReference Include="McProtocol" Version="1.2.5" />
|
<PackageReference Include="McProtocol" Version="1.2.5" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Configuration" Version="9.0.3" />
|
<PackageReference Include="Microsoft.Extensions.Configuration" Version="9.0.3" />
|
||||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="9.0.3" />
|
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="9.0.3" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="9.0.3" />
|
||||||
<PackageReference Include="SqlSugarCore" Version="5.1.4.182" />
|
<PackageReference Include="SqlSugarCore" Version="5.1.4.182" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
@ -25,7 +25,8 @@ public class HyosungRuntime(
|
|||||||
IVarietyService varietyService,
|
IVarietyService varietyService,
|
||||||
IHyosungAgvService hyosungAgvService,
|
IHyosungAgvService hyosungAgvService,
|
||||||
IHyosungWmsService hyosungWmsService,
|
IHyosungWmsService hyosungWmsService,
|
||||||
IDictService dictService) : IHyosungRuntime
|
IDictService dictService,
|
||||||
|
IReportExportService reportExportService) : IHyosungRuntime
|
||||||
{
|
{
|
||||||
public PackLineOption PackLineOption { get; private set; }
|
public PackLineOption PackLineOption { get; private set; }
|
||||||
public StackStationModel Stack1 { get; private set; } = new();
|
public StackStationModel Stack1 { get; private set; } = new();
|
||||||
@ -37,6 +38,7 @@ public class HyosungRuntime(
|
|||||||
|
|
||||||
public async Task StartAsync(CancellationToken token)
|
public async Task StartAsync(CancellationToken token)
|
||||||
{
|
{
|
||||||
|
//reportExportService.ExportNoExportAsync();
|
||||||
//启动扫码服务
|
//启动扫码服务
|
||||||
await hyosungScannerService.StartAsync(token);
|
await hyosungScannerService.StartAsync(token);
|
||||||
await printer.StartAsync(token);
|
await printer.StartAsync(token);
|
||||||
@ -192,8 +194,8 @@ public class HyosungRuntime(
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
await trayService.StorageAsync(info.TrayCode);
|
await trayService.StorageAsync(info.TrayCode);
|
||||||
|
reportExportService.ExportAsync(info.TrayCode);
|
||||||
await hyosungAgvService.StorageAsync(info.TrayCode);
|
await hyosungAgvService.StorageAsync(info.TrayCode);
|
||||||
_packingQueue?.TryDequeue(out _);
|
|
||||||
//标志下线已完成
|
//标志下线已完成
|
||||||
await hyosungPlcService.LeaveCompletedAsync();
|
await hyosungPlcService.LeaveCompletedAsync();
|
||||||
logger.LogInformation($"plc leaving production line success");
|
logger.LogInformation($"plc leaving production line success");
|
||||||
@ -300,8 +302,6 @@ public class HyosungRuntime(
|
|||||||
{
|
{
|
||||||
var tray = await trayService.GetByCode(arg);
|
var tray = await trayService.GetByCode(arg);
|
||||||
var variety = await varietyService.GetById(tray.VarietyId);
|
var variety = await varietyService.GetById(tray.VarietyId);
|
||||||
if (_packingQueue is null)
|
|
||||||
_packingQueue = new ConcurrentQueue<int>();
|
|
||||||
_packingQueue.Enqueue(variety.Id);
|
_packingQueue.Enqueue(variety.Id);
|
||||||
var mod = await hyosungWmsService.GetItemInfoByItemCode(variety.Code);
|
var mod = await hyosungWmsService.GetItemInfoByItemCode(variety.Code);
|
||||||
var grade = "1";
|
var grade = "1";
|
||||||
@ -311,8 +311,10 @@ public class HyosungRuntime(
|
|||||||
if (control is null)
|
if (control is null)
|
||||||
control = await hyosungWmsService.GetControlNo(variety, grade);
|
control = await hyosungWmsService.GetControlNo(variety, grade);
|
||||||
else
|
else
|
||||||
control = control + count;
|
control = control + 1;
|
||||||
var isEven = control % 2 == 0;
|
var isEven = control % 2 == 0;
|
||||||
|
await varietyService.SetLastNo(variety.Id, control.Value);
|
||||||
|
await trayService.SetControlNoAsync(arg, control.Value);
|
||||||
PackLineOption = new PackLineOption()
|
PackLineOption = new PackLineOption()
|
||||||
{
|
{
|
||||||
HeadCount = variety.StackHeadCount ?? 0,
|
HeadCount = variety.StackHeadCount ?? 0,
|
||||||
@ -355,19 +357,19 @@ public class HyosungRuntime(
|
|||||||
var tray = await trayService.GetByCode(arg);
|
var tray = await trayService.GetByCode(arg);
|
||||||
var variety = await varietyService.GetById(tray.VarietyId);
|
var variety = await varietyService.GetById(tray.VarietyId);
|
||||||
var mod = await hyosungWmsService.GetItemInfoByItemCode(variety.Code);
|
var mod = await hyosungWmsService.GetItemInfoByItemCode(variety.Code);
|
||||||
var grade = "1";
|
// var grade = "1";
|
||||||
if (mod.GRADE != "AA") grade = mod.GRADE;
|
// if (mod.GRADE != "AA") grade = mod.GRADE;
|
||||||
int? controlNo;
|
// int? controlNo;
|
||||||
if (tray.ControlNo is null || tray.ControlNo == 0)
|
// if (tray.ControlNo is null || tray.ControlNo == 0)
|
||||||
{
|
// {
|
||||||
controlNo = await varietyService.GetLastNo(variety.Id);
|
// controlNo = await varietyService.GetLastNo(variety.Id);
|
||||||
if (controlNo is null)
|
// if (controlNo is null)
|
||||||
controlNo = await hyosungWmsService.GetControlNo(variety, grade);
|
// controlNo = await hyosungWmsService.GetControlNo(variety, grade);
|
||||||
else
|
// else
|
||||||
controlNo += 1;
|
// controlNo += 1;
|
||||||
tray = await trayService.PrintTrayAsync(arg, controlNo.Value, mod);
|
//
|
||||||
}
|
// }
|
||||||
|
tray = await trayService.PrintTrayAsync(arg, mod);
|
||||||
await dictService.SetValue("System", "CurrentPackingTrayCode", arg);
|
await dictService.SetValue("System", "CurrentPackingTrayCode", arg);
|
||||||
await hyosungPlcService.WritePrintLableOptionsAsync(variety.MasterLabelCount);
|
await hyosungPlcService.WritePrintLableOptionsAsync(variety.MasterLabelCount);
|
||||||
}
|
}
|
||||||
@ -398,12 +400,11 @@ public class HyosungRuntime(
|
|||||||
{
|
{
|
||||||
await printer.PrintAsync(2, tray.TrayCode);
|
await printer.PrintAsync(2, tray.TrayCode);
|
||||||
await hyosungPlcService.WritePrintLabelResultAsync(arg1, true);
|
await hyosungPlcService.WritePrintLabelResultAsync(arg1, true);
|
||||||
await varietyService.SetLastNo(variety.Id, tray.ControlNo.Value);
|
// await varietyService.SetLastNo(variety.Id, tray.ControlNo.Value);
|
||||||
//await hyosungWmsService.UpdateControlNo(variety, tray.ControlNo.Value);
|
//await hyosungWmsService.UpdateControlNo(variety, tray.ControlNo.Value);
|
||||||
await hyosungWmsService.AddLabelResult(new LabelResult(tray, variety));
|
await hyosungWmsService.AddLabelResult(new LabelResult(tray, variety));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
logger.LogInformation($"plc request print label success");
|
logger.LogInformation($"plc request print label success");
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user