From 2978f083b697fb26d1f9a38c17358f50868fd8ec Mon Sep 17 00:00:00 2001 From: PhilPan Date: Fri, 12 May 2023 10:03:17 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=A4=96=E5=8C=85=E8=A3=85?= =?UTF-8?q?=E6=9D=A1=E7=A0=81=E6=89=93=E5=8D=B0=E6=8E=A5=E5=8F=A3=E5=AE=9A?= =?UTF-8?q?=E4=B9=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Entity/PrdWorklineState.cs | 165 ++++++++++++++++++ .../IQrPrintService.cs | 12 ++ .../Tnb.ProductionMgr/QrPrintService.cs | 81 +++++++++ system/Tnb.Systems/Common/SampleService.cs | 2 +- 4 files changed, 259 insertions(+), 1 deletion(-) create mode 100644 ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdWorklineState.cs create mode 100644 ProductionMgr/Tnb.ProductionMgr.Interfaces/IQrPrintService.cs create mode 100644 ProductionMgr/Tnb.ProductionMgr/QrPrintService.cs diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdWorklineState.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdWorklineState.cs new file mode 100644 index 00000000..52e9c4e3 --- /dev/null +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdWorklineState.cs @@ -0,0 +1,165 @@ +using SqlSugar; + +namespace Tnb.ProductionMgr.Entities; + +/// +///产线状态 +/// +[SugarTable("prd_workline_state")] +public partial class PrdWorklineState +{ + public PrdWorklineState() + { + + + } + /// + /// Desc:工序id + /// Default: + /// Nullable:False + /// + public string process_id { get; set; } + + /// + /// Desc:当前产品序列号 + /// Default: + /// Nullable:False + /// + public string lot_no { get; set; } + + /// + /// Desc:工单id + /// Default: + /// Nullable:True + /// + public string mo_id { get; set; } + + /// + /// Desc:更新时间 + /// Default: + /// Nullable:True + /// + public DateTime? update_time { get; set; } + + /// + /// Desc:需要的物料 + /// Default: + /// Nullable:False + /// + public string require_material_spec { get; set; } + + /// + /// Desc:扩展 + /// Default: + /// Nullable:True + /// + public string extras { get; set; } + + /// + /// Desc:当前产品 + /// Default: + /// Nullable:True + /// + public string product_code { get; set; } + + /// + /// Desc:当前产品 + /// Default: + /// Nullable:True + /// + public string product_name { get; set; } + + /// + /// Desc:当前产品 + /// Default: + /// Nullable:True + /// + public string product_spec { get; set; } + + /// + /// Desc:产线id + /// Default: + /// Nullable:False + /// + [SugarColumn(IsPrimaryKey = true)] + public string id { get; set; } + + /// + /// Desc:产线代码 + /// Default: + /// Nullable:True + /// + public string workline_code { get; set; } + + /// + /// Desc:工单代码 + /// Default: + /// Nullable:True + /// + public string mo_code { get; set; } + + /// + /// Desc:模具id + /// Default: + /// Nullable:True + /// + [SugarColumn(IsPrimaryKey = true)] + public string mold_id { get; set; } + + /// + /// Desc:工艺路线id + /// Default: + /// Nullable:True + /// + public string route_id { get; set; } + + /// + /// Desc:工艺路线代码 + /// Default: + /// Nullable:False + /// + public string route_code { get; set; } + + /// + /// Desc:工序代码 + /// Default: + /// Nullable:False + /// + public string process_code { get; set; } + + /// + /// Desc:工位id + /// Default: + /// Nullable:False + /// + public string station_id { get; set; } + + /// + /// Desc:工位代码 + /// Default: + /// Nullable:False + /// + public string station_code { get; set; } + + /// + /// Desc:需要的物料 + /// Default: + /// Nullable:False + /// + public string require_material_id { get; set; } + + /// + /// Desc:需要的物料 + /// Default: + /// Nullable:False + /// + public string require_material_code { get; set; } + + /// + /// Desc:需要的物料 + /// Default: + /// Nullable:True + /// + public string require_material_name { get; set; } + +} diff --git a/ProductionMgr/Tnb.ProductionMgr.Interfaces/IQrPrintService.cs b/ProductionMgr/Tnb.ProductionMgr.Interfaces/IQrPrintService.cs new file mode 100644 index 00000000..5ef9e4a6 --- /dev/null +++ b/ProductionMgr/Tnb.ProductionMgr.Interfaces/IQrPrintService.cs @@ -0,0 +1,12 @@ +using Tnb.ProductionMgr.Entities.Dto; + +namespace Tnb.ProductionMgr.Interfaces +{ + /// + /// 工单生成 + /// + public interface IQrPrintService + { + Task GetCartonQrcode(string workline); + } +} \ No newline at end of file diff --git a/ProductionMgr/Tnb.ProductionMgr/QrPrintService.cs b/ProductionMgr/Tnb.ProductionMgr/QrPrintService.cs new file mode 100644 index 00000000..ce19eacd --- /dev/null +++ b/ProductionMgr/Tnb.ProductionMgr/QrPrintService.cs @@ -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; + +/// +/// 外包装线条码打印接口 +/// +[ApiDescriptionSettings(Tag = ModuleConst.Tag, Area = ModuleConst.Area, Order = 704)] +[Route("api/produce")] +public class QrPrintService : IQrPrintService, IDynamicApiController, ITransient +{ + private readonly ISqlSugarRepository _repository; + private readonly IDataBaseManager _dataBaseManager; + private readonly IUserManager _userManager; + private readonly IDictionaryDataService _dictionaryDataService; + + public QrPrintService( + ISqlSugarRepository repository, + IDataBaseManager dataBaseManager, + IUserManager userManager, + IDictionaryDataService dictionaryDataService + ) + { + _repository = repository; + _dataBaseManager = dataBaseManager; + _userManager = userManager; + _dictionaryDataService = dictionaryDataService; + } + + + + #region Get + + /// + /// 获取产线当前生产的箱号条码 + /// + /// 所属产线 + /// + [HttpGet("get-carton-qrcode")] + [AllowAnonymous] + public async Task 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 +} + diff --git a/system/Tnb.Systems/Common/SampleService.cs b/system/Tnb.Systems/Common/SampleService.cs index d86e1db2..1a0a5523 100644 --- a/system/Tnb.Systems/Common/SampleService.cs +++ b/system/Tnb.Systems/Common/SampleService.cs @@ -24,7 +24,7 @@ namespace Tnb.BasicData /// /// 自定义开发服务示例 /// - [ApiDescriptionSettings(Tag = "ProductionMgr", Area = "production", Order = 503)] + [ApiDescriptionSettings(Tag = "ProductionManager", Area = "production", Order = 503)] [Route("api/[area]/[controller]/[action]")] [OverideVisualDev(ModelId)] public partial class SampleService : IOverideVisualDevService, IDynamicApiController, ITransient