Merge remote-tracking branch 'origin/Code-long'
This commit is contained in:
commit
999fb457a4
@ -2,8 +2,8 @@ namespace Seyounth.Core.Extensions;
|
|||||||
|
|
||||||
public static class DateTimeExtensions
|
public static class DateTimeExtensions
|
||||||
{
|
{
|
||||||
public static int ToTimestamp(this DateTime dateTime)
|
public static long ToTimestamp(this DateTime dateTime)
|
||||||
{
|
{
|
||||||
return (int)new DateTimeOffset(dateTime).ToUnixTimeSeconds();
|
return new DateTimeOffset(dateTime).ToUnixTimeMilliseconds();
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -13,7 +13,7 @@ public class HyosungAgvService(
|
|||||||
private readonly HikAgv _agv = new(loggerFactory.CreateLogger<HikAgv>());
|
private readonly HikAgv _agv = new(loggerFactory.CreateLogger<HikAgv>());
|
||||||
|
|
||||||
|
|
||||||
public async Task StorageAsync(string trayCode)
|
public async Task StorageAsync(long trayCode)
|
||||||
{
|
{
|
||||||
AgvStatusInfo? status;
|
AgvStatusInfo? status;
|
||||||
do
|
do
|
||||||
|
@ -7,5 +7,5 @@ public interface IHyosungAgvService
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="trayCode"></param>
|
/// <param name="trayCode"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task StorageAsync(string trayCode);
|
Task StorageAsync(long trayCode);
|
||||||
}
|
}
|
@ -46,12 +46,12 @@ public class HyosungPlcService(ILogger<HyosungPlcService> logger) : IHyosungPlcS
|
|||||||
logger.LogInformation($"write [{variety.Id}] to plc address[4230]");
|
logger.LogInformation($"write [{variety.Id}] to plc address[4230]");
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task WriteScanYarnResultAsync(bool result, short? varietyId = null, string? yarnCode = null)
|
public async Task WriteScanYarnResultAsync(bool result, short? varietyId = null, long yarnCode = 0)
|
||||||
{
|
{
|
||||||
if (result && yarnCode != null && varietyId != null)
|
if (result && yarnCode != null && varietyId != null)
|
||||||
{
|
{
|
||||||
await _writer.WriteShortsAsync(4009, varietyId.Value);
|
await _writer.WriteShortsAsync(4009, varietyId.Value);
|
||||||
await _writer.WriteStringAsync(4010, yarnCode);
|
await _writer.WriteLongAsync(4010, yarnCode);
|
||||||
logger.LogInformation($"write [{yarnCode}] to plc address[4010]");
|
logger.LogInformation($"write [{yarnCode}] to plc address[4010]");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -81,10 +81,10 @@ public class HyosungPlcService(ILogger<HyosungPlcService> logger) : IHyosungPlcS
|
|||||||
isLeaving = false;
|
isLeaving = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task WriteTrayCodeAsync(int index, string trayCode)
|
public async Task WriteTrayCodeAsync(int index, long trayCode)
|
||||||
{
|
{
|
||||||
var address = index == 1 ? 4100 : 4110;
|
var address = index == 1 ? 4100 : 4110;
|
||||||
await _writer.WriteStringAsync(address, trayCode);
|
await _writer.WriteLongAsync(address, trayCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task WriteReceivedYarnCountAsync(int count)
|
public async Task WriteReceivedYarnCountAsync(int count)
|
||||||
@ -124,9 +124,9 @@ public class HyosungPlcService(ILogger<HyosungPlcService> logger) : IHyosungPlcS
|
|||||||
|
|
||||||
public event Func<PlcStackingInfo, Task>? OnPlcPutCompleted;
|
public event Func<PlcStackingInfo, Task>? OnPlcPutCompleted;
|
||||||
|
|
||||||
public event Func<string, Task>? OnPlcRequestPackLineOption;
|
public event Func<long, Task>? OnPlcRequestPackLineOption;
|
||||||
|
|
||||||
public event Func<int, string, int, Task>? OnRequestPrintLabel;
|
public event Func<int, long, int, Task>? OnRequestPrintLabel;
|
||||||
|
|
||||||
|
|
||||||
private async Task ReadLoop(CancellationToken token)
|
private async Task ReadLoop(CancellationToken token)
|
||||||
@ -205,8 +205,8 @@ public class HyosungPlcService(ILogger<HyosungPlcService> logger) : IHyosungPlcS
|
|||||||
if (leavingProductionLine[0] == 1)
|
if (leavingProductionLine[0] == 1)
|
||||||
{
|
{
|
||||||
await _writer.WriteShortsAsync(4020, 0);
|
await _writer.WriteShortsAsync(4020, 0);
|
||||||
var trayCode = await _reader.ReadStringAsync(12600);
|
var trayCode = await _reader.ReadLongAsync(12600);
|
||||||
if (!string.IsNullOrEmpty(trayCode))
|
if (trayCode != 0)
|
||||||
{
|
{
|
||||||
PlcStackInfo info = new PlcStackInfo()
|
PlcStackInfo info = new PlcStackInfo()
|
||||||
{
|
{
|
||||||
@ -244,21 +244,21 @@ public class HyosungPlcService(ILogger<HyosungPlcService> logger) : IHyosungPlcS
|
|||||||
if (status[0] > 0)
|
if (status[0] > 0)
|
||||||
{
|
{
|
||||||
await _writer.WriteShortsAsync(4690, 0, 0, 0);
|
await _writer.WriteShortsAsync(4690, 0, 0, 0);
|
||||||
var trayCode = await _reader.ReadStringAsync(4620);
|
var trayCode = await _reader.ReadLongAsync(4620);
|
||||||
var yarn1 = await _reader.ReadStringAsync(4630);
|
var yarn1 = await _reader.ReadLongAsync(4630);
|
||||||
var yarn2 = await _reader.ReadStringAsync(4640);
|
var yarn2 = await _reader.ReadLongAsync(4640);
|
||||||
var yarn3 = await _reader.ReadStringAsync(4650);
|
var yarn3 = await _reader.ReadLongAsync(4650);
|
||||||
var info = new PlcStackingInfo()
|
var info = new PlcStackingInfo()
|
||||||
{
|
{
|
||||||
TrayCode = trayCode,
|
TrayCode = trayCode,
|
||||||
YarnCount = status[0],
|
YarnCount = status[0],
|
||||||
TotalYarnCount = status[1]
|
TotalYarnCount = status[1]
|
||||||
};
|
};
|
||||||
if (!string.IsNullOrEmpty(yarn1))
|
if (yarn1!=0)
|
||||||
info.YarnCode.Add(yarn1);
|
info.YarnCode.Add(yarn1);
|
||||||
if (!string.IsNullOrEmpty(yarn2))
|
if (yarn2!=0)
|
||||||
info.YarnCode.Add(yarn2);
|
info.YarnCode.Add(yarn2);
|
||||||
if (!string.IsNullOrEmpty(yarn3))
|
if (yarn3!=0)
|
||||||
info.YarnCode.Add(yarn3);
|
info.YarnCode.Add(yarn3);
|
||||||
if (info.YarnCode.Count != info.YarnCount)
|
if (info.YarnCode.Count != info.YarnCount)
|
||||||
{
|
{
|
||||||
@ -280,7 +280,7 @@ public class HyosungPlcService(ILogger<HyosungPlcService> logger) : IHyosungPlcS
|
|||||||
var requestPackLineOption = await _reader.ReadShortsAsync(4022, 1);
|
var requestPackLineOption = await _reader.ReadShortsAsync(4022, 1);
|
||||||
if (requestPackLineOption[0] == 1)
|
if (requestPackLineOption[0] == 1)
|
||||||
{
|
{
|
||||||
var trayCode = await _reader.ReadStringAsync(12100);
|
var trayCode = await _reader.ReadLongAsync(12100);
|
||||||
await _writer.WriteShortsAsync(4022, 0);
|
await _writer.WriteShortsAsync(4022, 0);
|
||||||
OnPlcRequestPackLineOption?.Invoke(trayCode);
|
OnPlcRequestPackLineOption?.Invoke(trayCode);
|
||||||
}
|
}
|
||||||
@ -291,7 +291,7 @@ public class HyosungPlcService(ILogger<HyosungPlcService> logger) : IHyosungPlcS
|
|||||||
var requestPrintLabel = await _reader.ReadShortsAsync(13010, 3);
|
var requestPrintLabel = await _reader.ReadShortsAsync(13010, 3);
|
||||||
if (requestPrintLabel[0] == 1)
|
if (requestPrintLabel[0] == 1)
|
||||||
{
|
{
|
||||||
var trayCode = await _reader.ReadStringAsync(13000);
|
var trayCode = await _reader.ReadLongAsync(13000);
|
||||||
await _writer.WriteShortsAsync(13010, 0);
|
await _writer.WriteShortsAsync(13010, 0);
|
||||||
await _writer.WriteShortsAsync(13012, 0);
|
await _writer.WriteShortsAsync(13012, 0);
|
||||||
OnRequestPrintLabel?.Invoke(1, trayCode, requestPrintLabel[2]);
|
OnRequestPrintLabel?.Invoke(1, trayCode, requestPrintLabel[2]);
|
||||||
@ -299,7 +299,7 @@ public class HyosungPlcService(ILogger<HyosungPlcService> logger) : IHyosungPlcS
|
|||||||
|
|
||||||
if (requestPrintLabel[1] == 1)
|
if (requestPrintLabel[1] == 1)
|
||||||
{
|
{
|
||||||
var trayCode = await _reader.ReadStringAsync(13000);
|
var trayCode = await _reader.ReadLongAsync(13000);
|
||||||
await _writer.WriteShortsAsync(13011, 0);
|
await _writer.WriteShortsAsync(13011, 0);
|
||||||
await _writer.WriteShortsAsync(13012, 0);
|
await _writer.WriteShortsAsync(13012, 0);
|
||||||
OnRequestPrintLabel?.Invoke(2, trayCode, requestPrintLabel[2]);
|
OnRequestPrintLabel?.Invoke(2, trayCode, requestPrintLabel[2]);
|
||||||
|
@ -24,7 +24,7 @@ public interface IHyosungPlcService
|
|||||||
/// <param name="varietyId">品类ID</param>
|
/// <param name="varietyId">品类ID</param>
|
||||||
/// <param name="yarnCode">纱码</param>
|
/// <param name="yarnCode">纱码</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task WriteScanYarnResultAsync(bool result, short? varietyId = null, string? yarnCode = null);
|
Task WriteScanYarnResultAsync(bool result, short? varietyId = null, long yarnCode = 0);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 写入治具扫码结果
|
/// 写入治具扫码结果
|
||||||
@ -47,7 +47,7 @@ public interface IHyosungPlcService
|
|||||||
/// <param name="index"></param>
|
/// <param name="index"></param>
|
||||||
/// <param name="trayCode"></param>
|
/// <param name="trayCode"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task WriteTrayCodeAsync(int index, string trayCode);
|
Task WriteTrayCodeAsync(int index, long trayCode);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 写入收到的纱数量
|
/// 写入收到的纱数量
|
||||||
@ -88,10 +88,10 @@ public interface IHyosungPlcService
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Plc请求打包线选项
|
/// Plc请求打包线选项
|
||||||
/// </summary>
|
/// </summary>
|
||||||
event Func<string, Task> OnPlcRequestPackLineOption;
|
event Func<long, Task> OnPlcRequestPackLineOption;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 贴标站请求贴标
|
/// 贴标站请求贴标
|
||||||
/// </summary>
|
/// </summary>
|
||||||
event Func<int, string, int, Task> OnRequestPrintLabel;
|
event Func<int, long, int, Task> OnRequestPrintLabel;
|
||||||
}
|
}
|
@ -51,6 +51,27 @@ public class McPlc(string host, int port, Mitsubishi.McFrame type)
|
|||||||
return shorts;
|
return shorts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task<long> ReadLongAsync(int address)
|
||||||
|
{
|
||||||
|
// 一个 long 类型是 8 字节,所以需要读取 8 个字节的数据
|
||||||
|
var bytes = await ReadBytesAsync(address, 8);
|
||||||
|
// 确保读取到了足够的字节
|
||||||
|
if (bytes.Length < 8)
|
||||||
|
{
|
||||||
|
throw new Exception("读取 long 类型数据时字节数不足");
|
||||||
|
}
|
||||||
|
// 将字节数组转换为 long 类型
|
||||||
|
return BitConverter.ToInt64(bytes, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task WriteLongAsync(int address, long value)
|
||||||
|
{
|
||||||
|
byte[] bytes = BitConverter.GetBytes(value);
|
||||||
|
|
||||||
|
// Write the byte array to the PLC
|
||||||
|
await WriteBytesAsync(address, bytes);
|
||||||
|
}
|
||||||
|
|
||||||
public async Task WriteShortsAsync(int address, params short[] values)
|
public async Task WriteShortsAsync(int address, params short[] values)
|
||||||
{
|
{
|
||||||
var code = await _mc.WriteDeviceBlock(Mitsubishi.PlcDeviceType.D, address, values.Length,
|
var code = await _mc.WriteDeviceBlock(Mitsubishi.PlcDeviceType.D, address, values.Length,
|
||||||
|
@ -34,7 +34,7 @@ public class HyosungPrinter(
|
|||||||
logger.LogInformation("printer disconnected");
|
logger.LogInformation("printer disconnected");
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task PrintAsync(int index, string trayCode)
|
public async Task PrintAsync(int index, long trayCode)
|
||||||
{
|
{
|
||||||
var tray = await trayService.GetByCode(trayCode);
|
var tray = await trayService.GetByCode(trayCode);
|
||||||
if (index == 1)
|
if (index == 1)
|
||||||
|
@ -11,5 +11,5 @@ public interface IHyosungPrinter
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="trayCode"></param>
|
/// <param name="trayCode"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task PrintAsync(int index,string trayCode);
|
Task PrintAsync(int index,long trayCode);
|
||||||
}
|
}
|
@ -12,7 +12,7 @@ public class ScannedYarnEntity
|
|||||||
public string QrCode { get; set; }
|
public string QrCode { get; set; }
|
||||||
|
|
||||||
[SugarColumn(ColumnDescription = "纱线代码", Length = 20)]
|
[SugarColumn(ColumnDescription = "纱线代码", Length = 20)]
|
||||||
public string ScanCode { get; set; }
|
public long ScanCode { get; set; }
|
||||||
|
|
||||||
[SugarColumn(ColumnDescription = "Lot")]
|
[SugarColumn(ColumnDescription = "Lot")]
|
||||||
public int Lot { get; set; }
|
public int Lot { get; set; }
|
||||||
|
@ -9,7 +9,7 @@ public class TrayEntity
|
|||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
|
|
||||||
[SugarColumn(ColumnDescription = "托盘唯一号")]
|
[SugarColumn(ColumnDescription = "托盘唯一号")]
|
||||||
public string TrayCode { get; set; }
|
public long TrayCode { get; set; }
|
||||||
|
|
||||||
[SugarColumn(ColumnDescription = "所属的品类信息")]
|
[SugarColumn(ColumnDescription = "所属的品类信息")]
|
||||||
public int VarietyId { get; set; }
|
public int VarietyId { get; set; }
|
||||||
|
@ -16,5 +16,5 @@ public partial class PackLineOption : ObservableObject
|
|||||||
|
|
||||||
[ObservableProperty] private bool isLam;
|
[ObservableProperty] private bool isLam;
|
||||||
|
|
||||||
[ObservableProperty] private string trayCode;
|
[ObservableProperty] private long trayCode;
|
||||||
}
|
}
|
@ -5,6 +5,6 @@ namespace Seyounth.Hyosung.Data.Models.Plc;
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class PlcStackInfo
|
public class PlcStackInfo
|
||||||
{
|
{
|
||||||
public string TrayCode { get; set; }
|
public long TrayCode { get; set; }
|
||||||
|
|
||||||
}
|
}
|
@ -2,9 +2,9 @@ namespace Seyounth.Hyosung.Data.Models.Plc;
|
|||||||
|
|
||||||
public class PlcStackingInfo
|
public class PlcStackingInfo
|
||||||
{
|
{
|
||||||
public string TrayCode { get; set; }
|
public long TrayCode { get; set; }
|
||||||
|
|
||||||
public List<string> YarnCode { get; set; } = new List<string>();
|
public List<long> YarnCode { get; set; } = new ();
|
||||||
|
|
||||||
public int YarnCount { get; set; }
|
public int YarnCount { get; set; }
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ public class Tray
|
|||||||
{
|
{
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
|
|
||||||
public string TrayCode { get; set; }
|
public long TrayCode { get; set; }
|
||||||
|
|
||||||
public int VarietyId { get; set; }
|
public int VarietyId { get; set; }
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ public class Yarn
|
|||||||
|
|
||||||
public string QrCode { get; set; }
|
public string QrCode { get; set; }
|
||||||
|
|
||||||
public string ScanCode { get; set; }
|
public long ScanCode { get; set; }
|
||||||
|
|
||||||
public int Lot { get; set; }
|
public int Lot { get; set; }
|
||||||
|
|
||||||
@ -53,7 +53,7 @@ public class Yarn
|
|||||||
ProduceTime = parts[3],
|
ProduceTime = parts[3],
|
||||||
ScanTime = DateTime.Now,
|
ScanTime = DateTime.Now,
|
||||||
VarietyId = varietyId,
|
VarietyId = varietyId,
|
||||||
ScanCode = DateTime.Now.ToTimestamp().ToString(),
|
ScanCode = DateTime.Now.ToTimestamp(),
|
||||||
TrayId = null
|
TrayId = null
|
||||||
};
|
};
|
||||||
yarn.WorkShift = parts[1] switch
|
yarn.WorkShift = parts[1] switch
|
||||||
@ -79,7 +79,7 @@ public class Yarn
|
|||||||
ScanTime = DateTime.Now,
|
ScanTime = DateTime.Now,
|
||||||
VarietyId = varietyId,
|
VarietyId = varietyId,
|
||||||
TrayId = null,
|
TrayId = null,
|
||||||
ScanCode = DateTime.Now.ToTimestamp().ToString().PadLeft(10, '0'),
|
ScanCode = DateTime.Now.ToTimestamp(),
|
||||||
};
|
};
|
||||||
yarn.WorkShift = parts[5] switch
|
yarn.WorkShift = parts[5] switch
|
||||||
{
|
{
|
||||||
|
@ -17,21 +17,21 @@ public interface ITrayService
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="code"></param>
|
/// <param name="code"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<int> GetIdByCode(string code);
|
Task<int> GetIdByCode(long code);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="code"></param>
|
/// <param name="code"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<Tray> GetByCode(string code);
|
Task<Tray> GetByCode(long code);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 生成控制号
|
/// 生成控制号
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="trayCode"></param>
|
/// <param name="trayCode"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task StorageAsync(string trayCode);
|
Task StorageAsync(long trayCode);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 打印托盘
|
/// 打印托盘
|
||||||
@ -41,5 +41,5 @@ public interface ITrayService
|
|||||||
/// <param name="controlNo"></param>
|
/// <param name="controlNo"></param>
|
||||||
/// <param name="itemInfo"></param>
|
/// <param name="itemInfo"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task PrintTrayAsync(string trayCode, int stackHeight, int controlNo, MST_ITEM_2240_V itemInfo);
|
Task PrintTrayAsync(long trayCode, int stackHeight, int controlNo, MST_ITEM_2240_V itemInfo);
|
||||||
}
|
}
|
@ -5,21 +5,21 @@ namespace Seyounth.Hyosung.Data.Services;
|
|||||||
|
|
||||||
public interface IYarnService
|
public interface IYarnService
|
||||||
{
|
{
|
||||||
ConcurrentDictionary<string, Yarn> NoFinished { get; }
|
ConcurrentDictionary<long, Yarn> NoFinished { get; }
|
||||||
|
|
||||||
Task<Yarn?> AddYarnAsync(Yarn yarn);
|
Task<Yarn?> AddYarnAsync(Yarn yarn);
|
||||||
|
|
||||||
|
|
||||||
Task<List<Yarn>> GetYarnsByTrayIdAsync(int trayId);
|
Task<List<Yarn>> GetYarnsByTrayIdAsync(int trayId);
|
||||||
|
|
||||||
Task<Yarn> GetYarnByCodeAsync(string code);
|
Task<Yarn> GetYarnByCodeAsync(long code);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 完成指定纱
|
/// 完成指定纱
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="yarnCode"></param>
|
/// <param name="yarnCode"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task FinishYarnAsync(string yarnCode);
|
Task FinishYarnAsync(long yarnCode);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 绑定托盘号
|
/// 绑定托盘号
|
||||||
@ -27,5 +27,5 @@ public interface IYarnService
|
|||||||
/// <param name="yarnCode"></param>
|
/// <param name="yarnCode"></param>
|
||||||
/// <param name="trayId"></param>
|
/// <param name="trayId"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task BindTrayAsync(string yarnCode, int trayId);
|
Task BindTrayAsync(long yarnCode, int trayId);
|
||||||
}
|
}
|
@ -11,7 +11,7 @@ namespace Seyounth.Hyosung.Data.Services;
|
|||||||
|
|
||||||
public class TrayService : ITrayService
|
public class TrayService : ITrayService
|
||||||
{
|
{
|
||||||
private readonly ConcurrentDictionary<string, Tray> _cache = new();
|
private readonly ConcurrentDictionary<long, Tray> _cache = new();
|
||||||
private readonly IRepository<TrayEntity> _repository;
|
private readonly IRepository<TrayEntity> _repository;
|
||||||
private readonly IHyosungWmsService _hyosungWmsService;
|
private readonly IHyosungWmsService _hyosungWmsService;
|
||||||
|
|
||||||
@ -30,7 +30,7 @@ public class TrayService : ITrayService
|
|||||||
{
|
{
|
||||||
var tray = new Tray()
|
var tray = new Tray()
|
||||||
{
|
{
|
||||||
TrayCode =DateTime.Now.ToTimestamp().ToString(),
|
TrayCode = DateTime.Now.ToTimestamp(),
|
||||||
VarietyId = varietyId,
|
VarietyId = varietyId,
|
||||||
CreateTime = DateTime.Now
|
CreateTime = DateTime.Now
|
||||||
};
|
};
|
||||||
@ -42,21 +42,19 @@ public class TrayService : ITrayService
|
|||||||
return tray;
|
return tray;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<int> GetIdByCode(string code)
|
public async Task<int> GetIdByCode(long code)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return _cache[code].Id;
|
return _cache[code].Id;
|
||||||
|
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
return (await _repository.GetFirstAsync(d => d.TrayCode == code)).Id;
|
return (await _repository.GetFirstAsync(d => d.TrayCode == code)).Id;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<Tray> GetByCode(string code)
|
public async Task<Tray> GetByCode(long code)
|
||||||
{
|
{
|
||||||
return Tray.FromEntity(await _repository.GetSingleAsync(t => t.TrayCode == code));
|
return Tray.FromEntity(await _repository.GetSingleAsync(t => t.TrayCode == code));
|
||||||
}
|
}
|
||||||
@ -66,7 +64,7 @@ public class TrayService : ITrayService
|
|||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task PrintTrayAsync(string trayCode, int stackHeight, int controlNo, MST_ITEM_2240_V itemInfo)
|
public async Task PrintTrayAsync(long trayCode, int stackHeight, int controlNo, MST_ITEM_2240_V itemInfo)
|
||||||
{
|
{
|
||||||
Tray tray;
|
Tray tray;
|
||||||
try
|
try
|
||||||
@ -91,7 +89,7 @@ public class TrayService : ITrayService
|
|||||||
_cache.Remove(tray.TrayCode, out _);
|
_cache.Remove(tray.TrayCode, out _);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task StorageAsync(string trayCode)
|
public async Task StorageAsync(long trayCode)
|
||||||
{
|
{
|
||||||
var tray = await GetByCode(trayCode);
|
var tray = await GetByCode(trayCode);
|
||||||
tray.FinishTime = DateTime.Now;
|
tray.FinishTime = DateTime.Now;
|
||||||
|
@ -13,7 +13,7 @@ public class YarnService : IYarnService
|
|||||||
public YarnService(IServiceProvider provider)
|
public YarnService(IServiceProvider provider)
|
||||||
{
|
{
|
||||||
_yarnRepository = provider.CreateScope().ServiceProvider.GetRequiredService<IRepository<ScannedYarnEntity>>();
|
_yarnRepository = provider.CreateScope().ServiceProvider.GetRequiredService<IRepository<ScannedYarnEntity>>();
|
||||||
NoFinished = new ConcurrentDictionary<string, Yarn>();
|
NoFinished = new ConcurrentDictionary<long, Yarn>();
|
||||||
var yarns = _yarnRepository.GetList(y => !y.IsFinished);
|
var yarns = _yarnRepository.GetList(y => !y.IsFinished);
|
||||||
foreach (var yarn in yarns)
|
foreach (var yarn in yarns)
|
||||||
{
|
{
|
||||||
@ -21,7 +21,7 @@ public class YarnService : IYarnService
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ConcurrentDictionary<string, Yarn> NoFinished { get; }
|
public ConcurrentDictionary<long, Yarn> NoFinished { get; }
|
||||||
|
|
||||||
public async Task<Yarn?> AddYarnAsync(Yarn yarn)
|
public async Task<Yarn?> AddYarnAsync(Yarn yarn)
|
||||||
{
|
{
|
||||||
@ -37,7 +37,7 @@ public class YarnService : IYarnService
|
|||||||
.Select(Yarn.FromEntity).ToList();
|
.Select(Yarn.FromEntity).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<Yarn> GetYarnByCodeAsync(string code)
|
public async Task<Yarn> GetYarnByCodeAsync(long code)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -50,7 +50,7 @@ public class YarnService : IYarnService
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task FinishYarnAsync(string yarnCode)
|
public async Task FinishYarnAsync(long yarnCode)
|
||||||
{
|
{
|
||||||
var yarn = NoFinished[yarnCode];
|
var yarn = NoFinished[yarnCode];
|
||||||
yarn.IsFinished = true;
|
yarn.IsFinished = true;
|
||||||
@ -58,7 +58,7 @@ public class YarnService : IYarnService
|
|||||||
NoFinished.TryRemove(yarnCode, out _);
|
NoFinished.TryRemove(yarnCode, out _);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task BindTrayAsync(string yarnCode, int trayId)
|
public async Task BindTrayAsync(long yarnCode, int trayId)
|
||||||
{
|
{
|
||||||
var yarn = NoFinished[yarnCode];
|
var yarn = NoFinished[yarnCode];
|
||||||
yarn.TrayId = trayId;
|
yarn.TrayId = trayId;
|
||||||
|
@ -245,7 +245,7 @@ public class HyosungRuntime(
|
|||||||
/// <param name="arg"></param>
|
/// <param name="arg"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
/// <exception cref="NotImplementedException"></exception>
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
private async Task OnPlcRequestPackLineOption(string arg)
|
private async Task OnPlcRequestPackLineOption(long arg)
|
||||||
{
|
{
|
||||||
logger.LogInformation($"plc request pack line option");
|
logger.LogInformation($"plc request pack line option");
|
||||||
try
|
try
|
||||||
@ -286,7 +286,7 @@ public class HyosungRuntime(
|
|||||||
/// <param name="arg2"></param>
|
/// <param name="arg2"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
/// <exception cref="NotImplementedException"></exception>
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
private async Task OnPlcRequestPrintLabel(int arg1, string trayCode, int height)
|
private async Task OnPlcRequestPrintLabel(int arg1, long trayCode, int height)
|
||||||
{
|
{
|
||||||
logger.LogInformation($"plc request print label:{arg1} {trayCode} {height}");
|
logger.LogInformation($"plc request print label:{arg1} {trayCode} {height}");
|
||||||
try
|
try
|
||||||
|
@ -9,7 +9,7 @@ namespace Seyounth.Hyosung.Runtime.Models;
|
|||||||
public partial class StackStationModel
|
public partial class StackStationModel
|
||||||
{
|
{
|
||||||
[ObservableProperty] [DefaultValue("NoData")]
|
[ObservableProperty] [DefaultValue("NoData")]
|
||||||
private string trayCode;
|
private long trayCode;
|
||||||
|
|
||||||
[ObservableProperty] [DefaultValue("NoData")]
|
[ObservableProperty] [DefaultValue("NoData")]
|
||||||
private string varietyCode;
|
private string varietyCode;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user