From 872c678b108e96c308ed8e88abfa7e54e8d9a8e3 Mon Sep 17 00:00:00 2001 From: zhangzhuo <512464164@qq.com> Date: Thu, 27 Mar 2025 09:12:16 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BA=86=E5=85=A5=E5=BA=93?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E4=BB=A5=E5=8F=8A=E7=9B=B8=E5=85=B3BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Seyounth.Hyosung.Core/Plc/HyosungPlcService.cs | 2 +- Seyounth.Hyosung.Core/Printer/AveryPrinter.cs | 6 +++--- Seyounth.Hyosung.Core/Printer/HyosungPrinter.cs | 4 ++-- .../Services/Hyosung/Entities/LabelResult.cs | 9 +++++---- Seyounth.Hyosung.Data/Services/TrayService.cs | 2 +- Seyounth.Hyosung.Runtime/HyosungRuntime.cs | 2 +- 6 files changed, 13 insertions(+), 12 deletions(-) diff --git a/Seyounth.Hyosung.Core/Plc/HyosungPlcService.cs b/Seyounth.Hyosung.Core/Plc/HyosungPlcService.cs index 62b178c..7099d49 100644 --- a/Seyounth.Hyosung.Core/Plc/HyosungPlcService.cs +++ b/Seyounth.Hyosung.Core/Plc/HyosungPlcService.cs @@ -148,7 +148,7 @@ public class HyosungPlcService(ILogger logger) : IHyosungPlcS break; } - await _writer.WriteShortsAsync(13050, [1, 1, 1, masterCount]); + await _writer.WriteShortsAsync(13050, [1, 1, 1, 2]); } public async Task WritePrintLabelResultAsync(int index, bool result) diff --git a/Seyounth.Hyosung.Core/Printer/AveryPrinter.cs b/Seyounth.Hyosung.Core/Printer/AveryPrinter.cs index 130d6cd..d63ce62 100644 --- a/Seyounth.Hyosung.Core/Printer/AveryPrinter.cs +++ b/Seyounth.Hyosung.Core/Printer/AveryPrinter.cs @@ -49,7 +49,7 @@ public class AveryPrinter(string host, int port) await ConnectAsync(CancellationToken.None); } - await _socket.SendAsync(Encoding.UTF8.GetBytes(context)); + await _socket.SendAsync(Encoding.ASCII.GetBytes(context)); } private const string CleanCmd = "#!A1#!CA#!P1"; @@ -63,7 +63,7 @@ public class AveryPrinter(string host, int port) await ConnectAsync(CancellationToken.None); } - await _socket.SendAsync(Encoding.UTF8.GetBytes(CleanCmd)); + await _socket.SendAsync(Encoding.ASCII.GetBytes(CleanCmd)); } public async Task PrintAsync() @@ -74,6 +74,6 @@ public class AveryPrinter(string host, int port) await ConnectAsync(CancellationToken.None); } - await _socket.SendAsync(Encoding.UTF8.GetBytes(PrintCmd)); + await _socket.SendAsync(Encoding.ASCII.GetBytes(PrintCmd)); } } \ No newline at end of file diff --git a/Seyounth.Hyosung.Core/Printer/HyosungPrinter.cs b/Seyounth.Hyosung.Core/Printer/HyosungPrinter.cs index e3f88bf..77b3773 100644 --- a/Seyounth.Hyosung.Core/Printer/HyosungPrinter.cs +++ b/Seyounth.Hyosung.Core/Printer/HyosungPrinter.cs @@ -121,14 +121,14 @@ public class HyosungPrinter( "250101J068", $"\"{DateTime.Now.ToString("yyMMdd" + "J") + tray.ControlNo.ToString()?.PadLeft(3, '0')}\"" }, - { "DTYY-JPA11530SFG250101000900115305480", $"\"{tray.Barcode}\"" } + { "DTYY-JPA11530SFG250101000900115305480", $"{tray.Barcode}" } }; string content = options.Value.DefaultTemp; foreach (var (key, value) in dic) { content = content.Replace(key, value); } - + logger.LogInformation($"print content: {content}"); return content; } } \ No newline at end of file diff --git a/Seyounth.Hyosung.Data/Services/Hyosung/Entities/LabelResult.cs b/Seyounth.Hyosung.Data/Services/Hyosung/Entities/LabelResult.cs index 60b8b4b..a554dc5 100644 --- a/Seyounth.Hyosung.Data/Services/Hyosung/Entities/LabelResult.cs +++ b/Seyounth.Hyosung.Data/Services/Hyosung/Entities/LabelResult.cs @@ -25,9 +25,9 @@ public class LabelResult // public string REMARKS { get; set; } = ""; // public string TRI_INTERFACE_YN { get; set; } = ""; public string TRI_TYPE { get; set; } = "zp10"; - //public string COMMON_S1 { get; set; } = ""; - //public string COMMON_S2 { get; set; } = ""; - //public string COMMON_S3 { get; set; } = ""; + public string COMMON_S1 { get; set; } = ""; + public string COMMON_S2 { get; set; } = ""; + public string COMMON_S3 { get; set; } = ""; //public string COMMON_S4 { get; set; } = ""; //public string COMMON_S5 { get; set; } = ""; //public string COMMON_N1 { get; set; } = ""; @@ -48,9 +48,10 @@ public class LabelResult GROSS_WEIGHT = (decimal)tray.GrossWeight; GRADE = tray.Grade ?? ""; LOT = variety.Lot.ToString(); - BOX_NO = tray.ControlNo?.ToString() ?? ""; + BOX_NO = $"{DateTime.Now.ToString("yyMMdd" + "J") + tray.ControlNo.ToString()?.PadLeft(3, '0')}"; CREATED_BY = "seyounth"; CREATED_ON = DateTime.Now.ToString("yyyy-MM-dd"); + COMMON_S2 = variety.TotalCount.ToString(); } public LabelResult() diff --git a/Seyounth.Hyosung.Data/Services/TrayService.cs b/Seyounth.Hyosung.Data/Services/TrayService.cs index 9e1df35..72e8dd4 100644 --- a/Seyounth.Hyosung.Data/Services/TrayService.cs +++ b/Seyounth.Hyosung.Data/Services/TrayService.cs @@ -92,7 +92,7 @@ public class TrayService : ITrayService if (netWeight.EndsWith(".0")) netWeight = netWeight.Replace(".0", ""); tray.Barcode = - $"{itemInfo.ITEM_CODE} {DateTime.Now:yyMMdd}{netWeight.PadLeft(6,'0')}{itemInfo.LOTNO.PadLeft(4, '0')}{tray.ControlNo?.ToString().PadLeft(4, '0')}0"; + $"{itemInfo.ITEM_CODE} {DateTime.Now:yyMMdd}{netWeight.PadLeft(6,'0')}{itemInfo.LOTNO.PadLeft(4, '0')}{tray.ControlNo?.ToString().PadLeft(4, '0')}0"; await _db.Updateable(tray.ToEntity()).ExecuteCommandAsync(); // _cache.Remove(tray.TrayCode, out _); return tray; diff --git a/Seyounth.Hyosung.Runtime/HyosungRuntime.cs b/Seyounth.Hyosung.Runtime/HyosungRuntime.cs index 4244c61..4140754 100644 --- a/Seyounth.Hyosung.Runtime/HyosungRuntime.cs +++ b/Seyounth.Hyosung.Runtime/HyosungRuntime.cs @@ -424,7 +424,7 @@ public class HyosungRuntime( await hyosungPlcService.WritePrintLabelResultAsync(arg1, true); // await varietyService.SetLastNo(variety.Id, 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");