增加外包装条码打印接口定义
This commit is contained in:
@@ -0,0 +1,165 @@
|
|||||||
|
using SqlSugar;
|
||||||
|
|
||||||
|
namespace Tnb.ProductionMgr.Entities;
|
||||||
|
|
||||||
|
///<summary>
|
||||||
|
///产线状态
|
||||||
|
///</summary>
|
||||||
|
[SugarTable("prd_workline_state")]
|
||||||
|
public partial class PrdWorklineState
|
||||||
|
{
|
||||||
|
public PrdWorklineState()
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Desc:工序id
|
||||||
|
/// Default:
|
||||||
|
/// Nullable:False
|
||||||
|
/// </summary>
|
||||||
|
public string process_id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Desc:当前产品序列号
|
||||||
|
/// Default:
|
||||||
|
/// Nullable:False
|
||||||
|
/// </summary>
|
||||||
|
public string lot_no { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Desc:工单id
|
||||||
|
/// Default:
|
||||||
|
/// Nullable:True
|
||||||
|
/// </summary>
|
||||||
|
public string mo_id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Desc:更新时间
|
||||||
|
/// Default:
|
||||||
|
/// Nullable:True
|
||||||
|
/// </summary>
|
||||||
|
public DateTime? update_time { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Desc:需要的物料
|
||||||
|
/// Default:
|
||||||
|
/// Nullable:False
|
||||||
|
/// </summary>
|
||||||
|
public string require_material_spec { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Desc:扩展
|
||||||
|
/// Default:
|
||||||
|
/// Nullable:True
|
||||||
|
/// </summary>
|
||||||
|
public string extras { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Desc:当前产品
|
||||||
|
/// Default:
|
||||||
|
/// Nullable:True
|
||||||
|
/// </summary>
|
||||||
|
public string product_code { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Desc:当前产品
|
||||||
|
/// Default:
|
||||||
|
/// Nullable:True
|
||||||
|
/// </summary>
|
||||||
|
public string product_name { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Desc:当前产品
|
||||||
|
/// Default:
|
||||||
|
/// Nullable:True
|
||||||
|
/// </summary>
|
||||||
|
public string product_spec { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Desc:产线id
|
||||||
|
/// Default:
|
||||||
|
/// Nullable:False
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(IsPrimaryKey = true)]
|
||||||
|
public string id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Desc:产线代码
|
||||||
|
/// Default:
|
||||||
|
/// Nullable:True
|
||||||
|
/// </summary>
|
||||||
|
public string workline_code { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Desc:工单代码
|
||||||
|
/// Default:
|
||||||
|
/// Nullable:True
|
||||||
|
/// </summary>
|
||||||
|
public string mo_code { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Desc:模具id
|
||||||
|
/// Default:
|
||||||
|
/// Nullable:True
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(IsPrimaryKey = true)]
|
||||||
|
public string mold_id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Desc:工艺路线id
|
||||||
|
/// Default:
|
||||||
|
/// Nullable:True
|
||||||
|
/// </summary>
|
||||||
|
public string route_id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Desc:工艺路线代码
|
||||||
|
/// Default:
|
||||||
|
/// Nullable:False
|
||||||
|
/// </summary>
|
||||||
|
public string route_code { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Desc:工序代码
|
||||||
|
/// Default:
|
||||||
|
/// Nullable:False
|
||||||
|
/// </summary>
|
||||||
|
public string process_code { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Desc:工位id
|
||||||
|
/// Default:
|
||||||
|
/// Nullable:False
|
||||||
|
/// </summary>
|
||||||
|
public string station_id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Desc:工位代码
|
||||||
|
/// Default:
|
||||||
|
/// Nullable:False
|
||||||
|
/// </summary>
|
||||||
|
public string station_code { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Desc:需要的物料
|
||||||
|
/// Default:
|
||||||
|
/// Nullable:False
|
||||||
|
/// </summary>
|
||||||
|
public string require_material_id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Desc:需要的物料
|
||||||
|
/// Default:
|
||||||
|
/// Nullable:False
|
||||||
|
/// </summary>
|
||||||
|
public string require_material_code { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Desc:需要的物料
|
||||||
|
/// Default:
|
||||||
|
/// Nullable:True
|
||||||
|
/// </summary>
|
||||||
|
public string require_material_name { get; set; }
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
using Tnb.ProductionMgr.Entities.Dto;
|
||||||
|
|
||||||
|
namespace Tnb.ProductionMgr.Interfaces
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 工单生成
|
||||||
|
/// </summary>
|
||||||
|
public interface IQrPrintService
|
||||||
|
{
|
||||||
|
Task<dynamic> GetCartonQrcode(string workline);
|
||||||
|
}
|
||||||
|
}
|
||||||
81
ProductionMgr/Tnb.ProductionMgr/QrPrintService.cs
Normal file
81
ProductionMgr/Tnb.ProductionMgr/QrPrintService.cs
Normal file
@@ -0,0 +1,81 @@
|
|||||||
|
using System.Dynamic;
|
||||||
|
using System.Reflection.Emit;
|
||||||
|
using Aop.Api.Domain;
|
||||||
|
using JNPF.Common.Core.Manager;
|
||||||
|
using JNPF.Common.Enums;
|
||||||
|
using JNPF.Common.Extension;
|
||||||
|
using JNPF.Common.Security;
|
||||||
|
using JNPF.DependencyInjection;
|
||||||
|
using JNPF.DynamicApiController;
|
||||||
|
using JNPF.Extensitions.EventBus;
|
||||||
|
using JNPF.FriendlyException;
|
||||||
|
using JNPF.Logging;
|
||||||
|
using JNPF.Systems.Interfaces.System;
|
||||||
|
using JNPF.VisualDev;
|
||||||
|
using JNPF.VisualDev.Entitys.Dto.VisualDevModelData;
|
||||||
|
using Mapster;
|
||||||
|
using Microsoft.AspNetCore.Authorization;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Senparc.Weixin.Work.AdvancedAPIs.MailList;
|
||||||
|
using SqlSugar;
|
||||||
|
using Tnb.BasicData;
|
||||||
|
using Tnb.BasicData.Entitys.Entity;
|
||||||
|
using Tnb.EquipMgr.Entities;
|
||||||
|
using Tnb.ProductionMgr.Entities;
|
||||||
|
using Tnb.ProductionMgr.Entities.Dto;
|
||||||
|
using Tnb.ProductionMgr.Entities.Enums;
|
||||||
|
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
|
||||||
|
{
|
||||||
|
private readonly ISqlSugarRepository<PrdWorklineState> _repository;
|
||||||
|
private readonly IDataBaseManager _dataBaseManager;
|
||||||
|
private readonly IUserManager _userManager;
|
||||||
|
private readonly IDictionaryDataService _dictionaryDataService;
|
||||||
|
|
||||||
|
public QrPrintService(
|
||||||
|
ISqlSugarRepository<PrdWorklineState> repository,
|
||||||
|
IDataBaseManager dataBaseManager,
|
||||||
|
IUserManager userManager,
|
||||||
|
IDictionaryDataService dictionaryDataService
|
||||||
|
)
|
||||||
|
{
|
||||||
|
_repository = repository;
|
||||||
|
_dataBaseManager = dataBaseManager;
|
||||||
|
_userManager = userManager;
|
||||||
|
_dictionaryDataService = dictionaryDataService;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#region Get
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取产线当前生产的箱号条码
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="workline">所属产线</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpGet("get-carton-qrcode")]
|
||||||
|
[AllowAnonymous]
|
||||||
|
public async Task<dynamic> GetCartonQrcode(string workline)
|
||||||
|
{
|
||||||
|
var line = await _repository.GetFirstAsync(a => a.id == workline);
|
||||||
|
var productNo = line?.process_code ?? "16945155732431";
|
||||||
|
var pd = DateTime.Now;
|
||||||
|
var exp = pd.AddYears(3);
|
||||||
|
var lotNo = pd.ToString("yyMMddHH");
|
||||||
|
string tpl = "(01){0}\n(11){1}\n(17){2}\n(10){3}";
|
||||||
|
string qrcode = string.Format(tpl, productNo, pd.ToString("yyMM00"), exp.ToString("yyMM00"), lotNo);
|
||||||
|
return new { qrcode };
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
|
||||||
@@ -24,7 +24,7 @@ namespace Tnb.BasicData
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 自定义开发服务示例
|
/// 自定义开发服务示例
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[ApiDescriptionSettings(Tag = "ProductionMgr", Area = "production", Order = 503)]
|
[ApiDescriptionSettings(Tag = "ProductionManager", Area = "production", Order = 503)]
|
||||||
[Route("api/[area]/[controller]/[action]")]
|
[Route("api/[area]/[controller]/[action]")]
|
||||||
[OverideVisualDev(ModelId)]
|
[OverideVisualDev(ModelId)]
|
||||||
public partial class SampleService : IOverideVisualDevService, IDynamicApiController, ITransient
|
public partial class SampleService : IOverideVisualDevService, IDynamicApiController, ITransient
|
||||||
|
|||||||
Reference in New Issue
Block a user