修复BUG 当前版本为可打印标签2 1张版本
This commit is contained in:
parent
a3245b7013
commit
c527e8135f
@ -97,18 +97,19 @@ public class HyosungPlcService(ILogger<HyosungPlcService> logger) : IHyosungPlcS
|
||||
List<short> ls = new List<short>();
|
||||
ls.Add((short)option.HeadCount);
|
||||
ls.Add((short)(option.IsTop ? 1 : 2));
|
||||
await _writer.WriteShortsAsync(12120, ls.ToArray());
|
||||
ls.Clear();
|
||||
ls.Add(1);
|
||||
ls.Add((short)(option.HasBox ? 1 : 2));
|
||||
ls.Add((short)(option.IsPack ? 1 : 2));
|
||||
ls.Add((short)(option.IsFilm ? 1 : 2));
|
||||
ls.Add((short)(option.IsLam ? 1 : 2));
|
||||
await _writer.WriteShortsAsync(12123, ls.ToArray());
|
||||
await _writer.WriteShortsAsync(12120, ls.ToArray());
|
||||
}
|
||||
|
||||
public async Task WritePrintLabelResultAsync(int index, bool result)
|
||||
{
|
||||
var address = index == 1 ? 13060 : 13061;
|
||||
if (index == 2)
|
||||
await _writer.WriteShortsAsync(13053, 4);
|
||||
await _writer.WriteShortsAsync(address, (short)(result ? 1 : 2));
|
||||
}
|
||||
|
||||
@ -298,7 +299,7 @@ public class HyosungPlcService(ILogger<HyosungPlcService> logger) : IHyosungPlcS
|
||||
|
||||
if (requestPrintLabel[1] == 1)
|
||||
{
|
||||
var trayCode = await _reader.ReadStringAsync(13001);
|
||||
var trayCode = await _reader.ReadStringAsync(13000);
|
||||
await _writer.WriteShortsAsync(13011, 0);
|
||||
await _writer.WriteShortsAsync(13012, 0);
|
||||
OnRequestPrintLabel?.Invoke(2, trayCode, requestPrintLabel[2]);
|
||||
|
@ -111,7 +111,7 @@ public class HyosungPrinter(
|
||||
{ "1670dtex -144F", $"\"{tray.DtexFila}\"" },
|
||||
{ "1500D - 144F", $"\"{tray.DenFila}\"" },
|
||||
{ "$SA", $"\"{tray.Grade}\"" },
|
||||
{ "$900", $"\"{labelResult.NET_WEIGHT}\"" },
|
||||
{ "$900", $"\"{labelResult.NET_WEIGHT.ToString("0.0")}\"" },
|
||||
{ "25-01-01", $"\"{DateTime.Now:yy-MM-dd}\"" },
|
||||
{ "$90", $"\"{variety.TotalCount}\"" },
|
||||
{ "$965", $"\"{labelResult.GROSS_WEIGHT}\"" },
|
||||
|
@ -5,7 +5,7 @@ namespace Seyounth.Hyosung.Data.Services.Hyosung.Entities;
|
||||
[SugarTable("LABEL_RESULT")]
|
||||
public class LabelResult
|
||||
{
|
||||
public int BE_ID { get; set; }
|
||||
public string BE_ID { get; set; }
|
||||
public string BAR_CODE { get; set; }
|
||||
public string ITEM_CODE { get; set; }
|
||||
public string LABEL_ID { get; set; }
|
||||
|
@ -53,9 +53,12 @@ public class HyosungWmsService : IHyosungWmsService
|
||||
else
|
||||
{
|
||||
await _db.Updateable<MST_BOXNO_SEQ_NON_DATE>()
|
||||
.SetColumns(i => i.LastNo == controlNo
|
||||
&& i.ModifiedTime == DateTime.Now
|
||||
&& i.ModifiedBy == "seyounth")
|
||||
.SetColumns(i => new MST_BOXNO_SEQ_NON_DATE
|
||||
{
|
||||
LastNo = controlNo,
|
||||
ModifiedTime = DateTime.Now,
|
||||
ModifiedBy = "seyounth"
|
||||
})
|
||||
.Where(i => i.BeId == "2240" &&
|
||||
i.ItemCode == variety.Code &&
|
||||
i.CheckCode == checkCode).ExecuteCommandAsync();
|
||||
@ -64,16 +67,23 @@ public class HyosungWmsService : IHyosungWmsService
|
||||
|
||||
public async Task<LabelResult> GetLabelResult(string itemCode, string lot, int controlNo)
|
||||
{
|
||||
string code = $"{itemCode.Trim()} {DateTime.Now.AddDays(0):yyMMdd}";
|
||||
string code2 = $"{lot.Trim()}{controlNo.ToString().PadLeft(4, '0')}0";
|
||||
try
|
||||
{
|
||||
string code = $"{itemCode.Trim()} {DateTime.Now.AddDays(0):yyMMdd}";
|
||||
string code2 = $"{lot.Trim()}{(controlNo-1).ToString().PadLeft(4, '0')}0";
|
||||
|
||||
// 使用 SqlSugar 进行查询
|
||||
return await _db.Queryable<LabelResult>()
|
||||
.Where(x =>
|
||||
x.BAR_CODE.Substring(0, 24) == code &&
|
||||
x.BAR_CODE.Substring(x.BAR_CODE.Length - 9, 9) == code2 &&
|
||||
x.BE_ID == 2240
|
||||
)
|
||||
.FirstAsync();
|
||||
// 使用 SqlSugar 进行查询
|
||||
return await _db.Queryable<LabelResult>()
|
||||
.Where(x =>
|
||||
x.BAR_CODE.Substring(0, 24) == code &&
|
||||
x.BAR_CODE.Substring(x.BAR_CODE.Length - 9, 9) == code2 &&
|
||||
x.BE_ID == "2240"
|
||||
)
|
||||
.FirstAsync();
|
||||
} catch (Exception e)
|
||||
{
|
||||
throw e;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -68,7 +68,16 @@ public class TrayService : ITrayService
|
||||
|
||||
public async Task PrintTrayAsync(string trayCode, int stackHeight, int controlNo, MST_ITEM_2240_V itemInfo)
|
||||
{
|
||||
var tray = _cache[trayCode];
|
||||
Tray tray;
|
||||
try
|
||||
{
|
||||
tray = _cache[trayCode];
|
||||
}
|
||||
catch
|
||||
{
|
||||
tray = await GetByCode(trayCode);
|
||||
}
|
||||
|
||||
tray.ControlNo = controlNo;
|
||||
tray.StackHeight = stackHeight;
|
||||
tray.Grade = itemInfo.GRADE;
|
||||
|
@ -291,22 +291,24 @@ public class HyosungRuntime(
|
||||
logger.LogInformation($"plc request print label:{arg1} {trayCode} {height}");
|
||||
try
|
||||
{
|
||||
if (arg1 == 1)
|
||||
{
|
||||
|
||||
var tray = await trayService.GetByCode(trayCode);
|
||||
var variety = await varietyService.GetById(tray.VarietyId);
|
||||
var mod = await hyosungWmsService.GetItemInfoByItemCode(variety.Code);
|
||||
var grade = "1";
|
||||
if (mod.GRADE != "AA") grade = mod.GRADE;
|
||||
var controlNo = await hyosungWmsService.GetControlNo(variety, grade);
|
||||
await trayService.PrintTrayAsync(trayCode, height, controlNo, mod);
|
||||
await printer.PrintAsync(1, trayCode);
|
||||
await hyosungWmsService.UpdateControlNo(variety, controlNo);
|
||||
await trayService.PrintTrayAsync(trayCode, height, controlNo, mod);
|
||||
if (arg1 == 1)
|
||||
{
|
||||
|
||||
await printer.PrintAsync(1, trayCode);
|
||||
}
|
||||
else
|
||||
await printer.PrintAsync(2, trayCode);
|
||||
|
||||
await hyosungPlcService.WritePrintLabelResultAsync(arg1, true);
|
||||
await hyosungWmsService.UpdateControlNo(variety, controlNo);
|
||||
logger.LogInformation($"plc request print label success");
|
||||
}
|
||||
catch (Exception e)
|
||||
|
Loading…
x
Reference in New Issue
Block a user