From 67c481f97c22b6b33819567fc026be8f2b8b940c Mon Sep 17 00:00:00 2001 From: zhoukeda <1315948824@qq.com> Date: Wed, 12 Jul 2023 10:19:15 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=A5=E5=BA=93=E7=94=B3=E8=AF=B7=E5=90=8C?= =?UTF-8?q?=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Entity/PrdInstockD.cs | 52 ++++++++++++++ .../Entity/PrdInstockH.cs | 67 +++++++++++++++++++ .../IPrdInstockService.cs | 16 +++++ .../Tnb.ProductionMgr/PrdInstockService.cs | 55 +++++++++++++++ 4 files changed, 190 insertions(+) create mode 100644 ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdInstockD.cs create mode 100644 ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdInstockH.cs create mode 100644 ProductionMgr/Tnb.ProductionMgr.Interfaces/IPrdInstockService.cs create mode 100644 ProductionMgr/Tnb.ProductionMgr/PrdInstockService.cs diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdInstockD.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdInstockD.cs new file mode 100644 index 00000000..7bff1e66 --- /dev/null +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdInstockD.cs @@ -0,0 +1,52 @@ +using JNPF.Common.Contracts; +using JNPF.Common.Security; +using SqlSugar; + +namespace Tnb.ProductionMgr.Entities; + +/// +/// mes申请入库子表 +/// +[SugarTable("prd_instock_d")] +public partial class PrdInstockD : BaseEntity +{ + public PrdInstockD() + { + id = SnowflakeIdHelper.NextId(); + } + /// + /// 入库申请主表id + /// + public string instock_id { get; set; } = string.Empty; + + /// + /// 物料id + /// + public string material_id { get; set; } = string.Empty; + + /// + /// 物料编号 + /// + public string material_code { get; set; } = string.Empty; + + /// + /// 单位 + /// + public string unit_id { get; set; } = string.Empty; + + /// + /// 数量 + /// + public string quantity { get; set; } = string.Empty; + + /// + /// 批次 + /// + public string code_batch { get; set; } = string.Empty; + + /// + /// 条码编号 + /// + public string barcode { get; set; } = string.Empty; + +} \ No newline at end of file diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdInstockH.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdInstockH.cs new file mode 100644 index 00000000..9616f5d2 --- /dev/null +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdInstockH.cs @@ -0,0 +1,67 @@ +using JNPF.Common.Contracts; +using JNPF.Common.Security; +using SqlSugar; + +namespace Tnb.ProductionMgr.Entities; + +/// +/// mes入库申请主表 +/// +[SugarTable("prd_instock_h")] +public partial class PrdInstockH : BaseEntity +{ + public PrdInstockH() + { + id = SnowflakeIdHelper.NextId(); + } + /// + /// 入库单创建日期 + /// + public DateTime bill_date { get; set; } = DateTime.Now; + + /// + /// 单据类型 + /// + public string bill_type { get; set; } = string.Empty; + + /// + /// 入库仓库ID + /// + public string warehouse_id { get; set; } = string.Empty; + + /// + /// 载具编号 + /// + public string carry_code { get; set; } = string.Empty; + + /// + /// 起始库位编号 + /// + public string location_code { get; set; } = string.Empty; + + /// + /// 来源单据ID + /// + public string source_id { get; set; } = string.Empty; + + /// + /// 检验(0-未检 1-已检) + /// + public string is_check { get; set; } = string.Empty; + + /// + /// 创建用户 + /// + public string? create_id { get; set; } + + /// + /// 所属组织 + /// + public string? org_id { get; set; } + + /// + /// 状态 1 申请入库 2 已入库 + /// + public int? status { get; set; } + +} \ No newline at end of file diff --git a/ProductionMgr/Tnb.ProductionMgr.Interfaces/IPrdInstockService.cs b/ProductionMgr/Tnb.ProductionMgr.Interfaces/IPrdInstockService.cs new file mode 100644 index 00000000..4d48963a --- /dev/null +++ b/ProductionMgr/Tnb.ProductionMgr.Interfaces/IPrdInstockService.cs @@ -0,0 +1,16 @@ +namespace Tnb.ProductionMgr.Interfaces +{ + /// + /// mes入库申请服务 + /// + public interface IPrdInstockService + { + + /// + /// 入库申请同步 + /// + /// source_id + /// + public Task SyncInstock(Dictionary dic); + } +} \ No newline at end of file diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdInstockService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdInstockService.cs new file mode 100644 index 00000000..e19f083e --- /dev/null +++ b/ProductionMgr/Tnb.ProductionMgr/PrdInstockService.cs @@ -0,0 +1,55 @@ +using JNPF.Common.Core.Manager; +using JNPF.DependencyInjection; +using JNPF.DynamicApiController; +using JNPF.Systems.Interfaces.System; +using Microsoft.AspNetCore.Mvc; +using SqlSugar; +using Tnb.ProductionMgr.Entities; +using Tnb.ProductionMgr.Entities.Dto; +using Tnb.ProductionMgr.Interfaces; + +namespace Tnb.ProductionMgr +{ + /// + /// mes入库申请 + /// + [ApiDescriptionSettings(Tag = ModuleConst.Tag, Area = ModuleConst.Area, Order = 700)] + [Route("api/[area]/[controller]/[action]")] + public class PrdInstockService : IPrdInstockService, IDynamicApiController, ITransient + { + private readonly ISqlSugarRepository _repository; + private readonly IUserManager _userManager; + private readonly IBillRullService _billRullService; + + + public PrdInstockService( + ISqlSugarRepository repository, + IBillRullService billRullService, + IUserManager userManager + ) + { + _repository = repository; + _userManager = userManager; + _billRullService = billRullService; + } + + /// + /// 入库申请同步 + /// + /// source_id + /// + public async Task SyncInstock(Dictionary dic) + { + string sourceId = dic.ContainsKey("source_id") ? dic["source_id"] : ""; + if (!string.IsNullOrEmpty(sourceId)) + { + return await _repository.UpdateAsync(x => new PrdInstockH() + { + status = 1 + }, x => x.id == sourceId); + } + + return false; + } + } +} \ No newline at end of file