修改1号打印机为黑色标签打印
This commit is contained in:
parent
e3e12cb62b
commit
c73cd48542
@ -103,13 +103,14 @@ public class HyosungPlcService(ILogger<HyosungPlcService> logger) : IHyosungPlcS
|
|||||||
ls.Add((short)(option.IsPack ? 1 : 2));
|
ls.Add((short)(option.IsPack ? 1 : 2));
|
||||||
ls.Add((short)(option.IsFilm ? 1 : 2));
|
ls.Add((short)(option.IsFilm ? 1 : 2));
|
||||||
ls.Add((short)(option.IsLam ? 1 : 2));
|
ls.Add((short)(option.IsLam ? 1 : 2));
|
||||||
|
ls.Add((short)(option.IsBlack ? 2 : 1));
|
||||||
await _writer.WriteShortsAsync(12120, ls.ToArray());
|
await _writer.WriteShortsAsync(12120, ls.ToArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task WritePrintLableOptionsAsync(int side, int slave)
|
public async Task WritePrintLableOptionsAsync(bool isBlack, int count)
|
||||||
{
|
{
|
||||||
short masterCount = 0;
|
short masterCount = 0;
|
||||||
switch (side)
|
switch (count)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
masterCount = 1;
|
masterCount = 1;
|
||||||
@ -128,27 +129,10 @@ public class HyosungPlcService(ILogger<HyosungPlcService> logger) : IHyosungPlcS
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
short slaveCount = 0;
|
if (isBlack)
|
||||||
switch (slave)
|
await _writer.WriteShortsAsync(13050, [1, 1, masterCount, 1]);
|
||||||
{
|
else
|
||||||
case 0:
|
await _writer.WriteShortsAsync(13050, [1, 1, 1, masterCount]);
|
||||||
slaveCount = 1;
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
slaveCount = 2;
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
slaveCount = 6;
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
slaveCount = 14;
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
slaveCount = 30;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
await _writer.WriteShortsAsync(13050, [1, 1, 1, masterCount]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task WritePrintLabelResultAsync(int index, bool result)
|
public async Task WritePrintLabelResultAsync(int index, bool result)
|
||||||
|
@ -58,7 +58,7 @@ public interface IHyosungPlcService
|
|||||||
|
|
||||||
Task WritePackLineOptionAsync(PackLineOption option);
|
Task WritePackLineOptionAsync(PackLineOption option);
|
||||||
|
|
||||||
Task WritePrintLableOptionsAsync(int side,int slaveCount);
|
Task WritePrintLableOptionsAsync(bool isBlack,int slaveCount);
|
||||||
|
|
||||||
Task WritePrintLabelResultAsync(int index, bool result);
|
Task WritePrintLabelResultAsync(int index, bool result);
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ public class HyosungPrinter(
|
|||||||
private async Task PrintLabel1Async(Tray tray)
|
private async Task PrintLabel1Async(Tray tray)
|
||||||
{
|
{
|
||||||
await _masterPrinter.CleanContextAsync();
|
await _masterPrinter.CleanContextAsync();
|
||||||
var content = await GetPrint1Content(tray);
|
var content = await GetPrint2Content(tray);
|
||||||
await _masterPrinter.SendContentAsync(content);
|
await _masterPrinter.SendContentAsync(content);
|
||||||
await _masterPrinter.PrintAsync();
|
await _masterPrinter.PrintAsync();
|
||||||
}
|
}
|
||||||
|
@ -57,7 +57,7 @@ public class VarietyEntity
|
|||||||
[SugarColumn(ColumnDescription = "垛头数量")]
|
[SugarColumn(ColumnDescription = "垛头数量")]
|
||||||
public int? StackHeadCount { get; set; }
|
public int? StackHeadCount { get; set; }
|
||||||
|
|
||||||
[SugarColumn(ColumnDescription = "纸托Id",IsNullable =true)]
|
[SugarColumn(ColumnDescription = "纸托Id", IsNullable = true)]
|
||||||
public int? PaperTrayId { get; set; }
|
public int? PaperTrayId { get; set; }
|
||||||
|
|
||||||
[SugarColumn(ColumnDescription = "是否需要纸箱")]
|
[SugarColumn(ColumnDescription = "是否需要纸箱")]
|
||||||
@ -84,13 +84,11 @@ public class VarietyEntity
|
|||||||
[SugarColumn(ColumnDescription = "副标签数量")]
|
[SugarColumn(ColumnDescription = "副标签数量")]
|
||||||
public int SubLabelCount { get; set; }
|
public int SubLabelCount { get; set; }
|
||||||
|
|
||||||
[SugarColumn(IsNullable =true)]
|
[SugarColumn(IsNullable = true)] public int? LastNo { get; set; }
|
||||||
public int? LastNo { get; set; }
|
|
||||||
|
[SugarColumn(IsNullable = true)] public double? NetWeight { get; set; }
|
||||||
[SugarColumn(IsNullable =true)]
|
|
||||||
public double? NetWeight { get; set; }
|
[SugarColumn(IsNullable = true)] public double? GrossWeight { get; set; }
|
||||||
|
|
||||||
[SugarColumn(IsNullable =true)]
|
[SugarColumn(IsNullable = true)] public bool? IsBlack { get; set; }
|
||||||
public double? GrossWeight { get; set; }
|
|
||||||
|
|
||||||
}
|
}
|
@ -17,4 +17,6 @@ public partial class PackLineOption : ObservableObject
|
|||||||
[ObservableProperty] private bool isLam;
|
[ObservableProperty] private bool isLam;
|
||||||
|
|
||||||
[ObservableProperty] private string trayCode;
|
[ObservableProperty] private string trayCode;
|
||||||
|
|
||||||
|
[ObservableProperty] private bool isBlack;
|
||||||
}
|
}
|
@ -69,6 +69,8 @@ public class Variety
|
|||||||
public double? NetWeight { get; set; }
|
public double? NetWeight { get; set; }
|
||||||
|
|
||||||
public double? GrossWeight { get; set; }
|
public double? GrossWeight { get; set; }
|
||||||
|
|
||||||
|
public bool? IsBlack { get; set; }
|
||||||
|
|
||||||
public static Variety Create(VarietyEntity entity, List<PalletEntity> pallets)
|
public static Variety Create(VarietyEntity entity, List<PalletEntity> pallets)
|
||||||
{
|
{
|
||||||
@ -101,7 +103,8 @@ public class Variety
|
|||||||
HasBox = entity.HasBox,
|
HasBox = entity.HasBox,
|
||||||
LastNo = entity.LastNo,
|
LastNo = entity.LastNo,
|
||||||
NetWeight = entity.NetWeight,
|
NetWeight = entity.NetWeight,
|
||||||
GrossWeight = entity.GrossWeight
|
GrossWeight = entity.GrossWeight,
|
||||||
|
IsBlack = entity.IsBlack
|
||||||
};
|
};
|
||||||
if (entity.PaperTrayId != null && entity.PaperTrayId != 0)
|
if (entity.PaperTrayId != null && entity.PaperTrayId != 0)
|
||||||
variety.PaperTray = Pallet.FromEntity(pallets.First(x => x.Id == entity.PaperTrayId));
|
variety.PaperTray = Pallet.FromEntity(pallets.First(x => x.Id == entity.PaperTrayId));
|
||||||
@ -141,7 +144,8 @@ public class Variety
|
|||||||
HasBox = HasBox,
|
HasBox = HasBox,
|
||||||
LastNo = LastNo,
|
LastNo = LastNo,
|
||||||
NetWeight = NetWeight,
|
NetWeight = NetWeight,
|
||||||
GrossWeight = GrossWeight
|
GrossWeight = GrossWeight,
|
||||||
|
IsBlack = IsBlack
|
||||||
};
|
};
|
||||||
return entity;
|
return entity;
|
||||||
}
|
}
|
||||||
|
@ -121,7 +121,6 @@ public class HyosungRuntime(
|
|||||||
var trays = await trayService.GetTodayTrayAsync();
|
var trays = await trayService.GetTodayTrayAsync();
|
||||||
foreach (var tray in trays)
|
foreach (var tray in trays)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -354,6 +353,7 @@ public class HyosungRuntime(
|
|||||||
PackLineOption.IsLam = true;
|
PackLineOption.IsLam = true;
|
||||||
else
|
else
|
||||||
PackLineOption.IsLam = false;
|
PackLineOption.IsLam = false;
|
||||||
|
PackLineOption.IsBlack = variety.IsBlack ?? false;
|
||||||
await hyosungPlcService.WritePackLineOptionAsync(PackLineOption);
|
await hyosungPlcService.WritePackLineOptionAsync(PackLineOption);
|
||||||
logger.LogInformation($"plc request pack line option success");
|
logger.LogInformation($"plc request pack line option success");
|
||||||
}
|
}
|
||||||
@ -386,14 +386,14 @@ public class HyosungRuntime(
|
|||||||
// }
|
// }
|
||||||
tray = await trayService.PrintTrayAsync(arg, mod, variety);
|
tray = await trayService.PrintTrayAsync(arg, mod, variety);
|
||||||
await dictService.SetValue("System", "CurrentPackingTrayCode", arg);
|
await dictService.SetValue("System", "CurrentPackingTrayCode", arg);
|
||||||
await hyosungPlcService.WritePrintLableOptionsAsync(variety.MasterLabelCount, variety.SubLabelCount);
|
await hyosungPlcService.WritePrintLableOptionsAsync(variety.IsBlack ?? false, variety.MasterLabelCount);
|
||||||
|
await hyosungWmsService.AddLabelResult(new LabelResult(tray, variety));
|
||||||
logger.LogInformation("request print option succeed");
|
logger.LogInformation("request print option succeed");
|
||||||
}
|
}
|
||||||
catch(Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
logger.LogError(e, "GetPrintOptionError");
|
logger.LogError(e, "GetPrintOptionError");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -413,20 +413,8 @@ public class HyosungRuntime(
|
|||||||
await trayService.UpdateHeightAsync(tray.TrayCode, height);
|
await trayService.UpdateHeightAsync(tray.TrayCode, height);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (arg1 == 1)
|
await printer.PrintAsync(arg1, tray.TrayCode);
|
||||||
{
|
await hyosungPlcService.WritePrintLabelResultAsync(arg1, true);
|
||||||
await printer.PrintAsync(1, tray.TrayCode);
|
|
||||||
await hyosungPlcService.WritePrintLabelResultAsync(arg1, true);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
await printer.PrintAsync(2, tray.TrayCode);
|
|
||||||
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));
|
|
||||||
}
|
|
||||||
|
|
||||||
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