外包装条码打印接口

This commit is contained in:
2023-05-12 10:18:54 +08:00
parent 2978f083b6
commit 2df0106047
2 changed files with 11 additions and 6 deletions

View File

@@ -5,7 +5,7 @@ namespace Tnb.ProductionMgr.Interfaces
/// <summary>
/// 工单生成
/// </summary>
public interface IQrPrintService
public interface IWorklineCommService
{
Task<dynamic> GetCartonQrcode(string workline);
}

View File

@@ -29,18 +29,18 @@ using Tnb.ProductionMgr.Interfaces;
namespace Tnb.ProductionMgr;
/// <summary>
/// 外包装线条码打印接口
/// 产线自动化通信接口
/// </summary>
[ApiDescriptionSettings(Tag = ModuleConst.Tag, Area = ModuleConst.Area, Order = 704)]
[Route("api/produce")]
public class QrPrintService : IQrPrintService, IDynamicApiController, ITransient
public class WorklineCommService : IWorklineCommService, IDynamicApiController, ITransient
{
private readonly ISqlSugarRepository<PrdWorklineState> _repository;
private readonly IDataBaseManager _dataBaseManager;
private readonly IUserManager _userManager;
private readonly IDictionaryDataService _dictionaryDataService;
public QrPrintService(
public WorklineCommService(
ISqlSugarRepository<PrdWorklineState> repository,
IDataBaseManager dataBaseManager,
IUserManager userManager,
@@ -55,7 +55,7 @@ public class QrPrintService : IQrPrintService, IDynamicApiController, ITransient
#region Get
#region
/// <summary>
/// 获取产线当前生产的箱号条码
@@ -67,7 +67,12 @@ public class QrPrintService : IQrPrintService, IDynamicApiController, ITransient
public async Task<dynamic> GetCartonQrcode(string workline)
{
var line = await _repository.GetFirstAsync(a => a.id == workline);
var productNo = line?.process_code ?? "16945155732431";
var productNo = line?.product_code;
//TODO 仅测试接口用
if (string.IsNullOrEmpty(productNo))
{
productNo = "16945" + Random.Shared.Next(0, 999999999).ToString(); //"16945155732431";
}
var pd = DateTime.Now;
var exp = pd.AddYears(3);
var lotNo = pd.ToString("yyMMddHH");