From 7980e342c02a291c4f5af7b5bbaffbdba1acceb6 Mon Sep 17 00:00:00 2001 From: "yang.lee" Date: Wed, 8 Nov 2023 16:24:47 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9EMes=E6=A3=80=E9=AA=8C?= =?UTF-8?q?=E7=BB=93=E6=9D=9F=E5=90=8E=EF=BC=8C=E5=9B=9E=E8=B0=83=E9=80=9A?= =?UTF-8?q?=E7=9F=A5=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Dto/Inputs/MesCheckdCallbackUpInput.cs | 23 ++++++++++++++++++ .../InOutCheckStatusUpdateEntity.cs | 19 +++++++++++++++ .../Entity/WmsInstockH.cs | 7 +++++- .../Entity/WmsOutstockH.cs | 7 +++++- .../Tnb.WarehouseMgr/Tnb.WarehouseMgr.csproj | 1 + .../WmsPurchaseAndSaleCommonService.cs | 5 ++++ .../Tnb.WarehouseMgr/WmsPurchaseService.cs | 24 +++++++++++++++++-- .../Tnb.WarehouseMgr/WmsSaleService.cs | 12 ++++++++++ 8 files changed, 94 insertions(+), 4 deletions(-) create mode 100644 WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/MesCheckdCallbackUpInput.cs create mode 100644 WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/Constraints/InOutCheckStatusUpdateEntity.cs diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/MesCheckdCallbackUpInput.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/MesCheckdCallbackUpInput.cs new file mode 100644 index 00000000..c0675af0 --- /dev/null +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/MesCheckdCallbackUpInput.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tnb.WarehouseMgr.Entities.Dto.Inputs +{ + /// + /// Mes检验后回传输入参数 + /// + public class MesCheckdCallbackUpinput + { + /// + /// 主表Id + /// + public string maintableid { get; set; } + /// + /// 检验结论 + /// + public int check_conclusion { get; set; } + } +} diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/Constraints/InOutCheckStatusUpdateEntity.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/Constraints/InOutCheckStatusUpdateEntity.cs new file mode 100644 index 00000000..c69f364c --- /dev/null +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/Constraints/InOutCheckStatusUpdateEntity.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tnb.WarehouseMgr.Entities.Entity.Constraints +{ + /// + /// 修改出入库检验状态 + /// + public interface InOutCheckStatusUpdateEntity + { + /// + /// 检验状态 + /// + public int? check_conclusion { get; set; } + } +} diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsInstockH.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsInstockH.cs index 97516e77..44e6c1c0 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsInstockH.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsInstockH.cs @@ -1,6 +1,7 @@ using JNPF.Common.Contracts; using JNPF.Common.Security; using SqlSugar; +using Tnb.WarehouseMgr.Entities.Entity.Constraints; namespace Tnb.WarehouseMgr.Entities; @@ -8,7 +9,7 @@ namespace Tnb.WarehouseMgr.Entities; /// 入库申请主表 /// [SugarTable("wms_instock_h")] -public partial class WmsInstockH : BaseEntity +public partial class WmsInstockH : BaseEntity, InOutCheckStatusUpdateEntity { public WmsInstockH() { @@ -212,4 +213,8 @@ public partial class WmsInstockH : BaseEntity /// 采购单号 /// public string purchase_code { get; set; } + /// + /// 检验结论 + /// + public int? check_conclusion { get; set; } } diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsOutstockH.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsOutstockH.cs index 6416d598..18b25742 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsOutstockH.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsOutstockH.cs @@ -1,6 +1,7 @@ using JNPF.Common.Contracts; using JNPF.Common.Security; using SqlSugar; +using Tnb.WarehouseMgr.Entities.Entity.Constraints; namespace Tnb.WarehouseMgr.Entities; @@ -8,7 +9,7 @@ namespace Tnb.WarehouseMgr.Entities; /// 出库申请主表 /// [SugarTable("wms_outstock_h")] -public partial class WmsOutstockH : BaseEntity +public partial class WmsOutstockH : BaseEntity, InOutCheckStatusUpdateEntity { public WmsOutstockH() { @@ -170,4 +171,8 @@ public partial class WmsOutstockH : BaseEntity /// 载具Id /// public string carry_id { get; set; } + /// + /// 检验结论 + /// + public int? check_conclusion { get; set; } } diff --git a/WarehouseMgr/Tnb.WarehouseMgr/Tnb.WarehouseMgr.csproj b/WarehouseMgr/Tnb.WarehouseMgr/Tnb.WarehouseMgr.csproj index 7d6b065d..238adaa3 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/Tnb.WarehouseMgr.csproj +++ b/WarehouseMgr/Tnb.WarehouseMgr/Tnb.WarehouseMgr.csproj @@ -14,6 +14,7 @@ + diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPurchaseAndSaleCommonService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPurchaseAndSaleCommonService.cs index 7e6db845..ab4e11cd 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPurchaseAndSaleCommonService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPurchaseAndSaleCommonService.cs @@ -118,5 +118,10 @@ namespace Tnb.WarehouseMgr return await _db.Updateable().SetColumns(it => it.audit_status == (int)input.auditType).Where(it => input.ids.Contains(it.id)).ExecuteCommandHasChangeAsync(); } + protected async Task UpdateChackStatus(MesCheckdCallbackUpinput input) where TEntity : BaseEntity, InOutCheckStatusUpdateEntity, new() + { + return await _db.Updateable().SetColumns(it => it.check_conclusion == input.check_conclusion).Where(it => it.id == input.maintableid).ExecuteCommandHasChangeAsync(); + } + } } diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPurchaseService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPurchaseService.cs index 35225662..c00e83ae 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPurchaseService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPurchaseService.cs @@ -18,6 +18,9 @@ using NPOI.OpenXmlFormats.Dml.Diagram; using SqlSugar; using Tnb.BasicData.Entities; using Tnb.Common.Utils; +using Tnb.QcMgr.Entities; +using Tnb.QcMgr.Entities.Enums; +using Tnb.QcMgr.Interfaces; using Tnb.WarehouseMgr.Entities; using Tnb.WarehouseMgr.Entities.Consts; using Tnb.WarehouseMgr.Entities.Dto; @@ -34,11 +37,13 @@ namespace Tnb.WarehouseMgr { private readonly ISqlSugarClient _db; private readonly IUserManager _userManager; - public WmsPurchaseService(ISqlSugarRepository repo, IUserManager userManager) + private readonly IQcCheckPlanService _qcCheckPlanService; + public WmsPurchaseService(ISqlSugarRepository repo, IUserManager userManager, IQcCheckPlanService qcCheckPlanService) : base(repo, userManager) { _db = repo.AsSugarClient(); _userManager = userManager; + _qcCheckPlanService = qcCheckPlanService; } private async Task xxx(VisualDevModelDataCrInput input) @@ -84,7 +89,11 @@ namespace Tnb.WarehouseMgr await _db.Insertable(instockDs).ExecuteCommandAsync(); } //通知Mes接口 - + CreateTaskEntity ctEntity = new(); + ctEntity.maintableid = instock.id; + ctEntity.materialids = instockDs.Select(x => x.material_id).ToList(); + ctEntity.triggerevent = EnumTriggerEvent.入厂检按物料编号; + _ = _qcCheckPlanService.CreateWmsTask(ctEntity); await _db.Ado.CommitTranAsync(); } catch (Exception ex) @@ -119,5 +128,16 @@ namespace Tnb.WarehouseMgr { return await Audit(input); } + /// + /// mes 检验完后通知wms(采购) 回调接口 + /// + /// + /// + /// + [HttpPost] + public async Task MesCheckdPurchaseCallback(MesCheckdCallbackUpinput input) + { + return await UpdateChackStatus(input); + } } } diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsSaleService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsSaleService.cs index 47b614c5..1605a513 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsSaleService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsSaleService.cs @@ -72,5 +72,17 @@ namespace Tnb.WarehouseMgr return await Audit(input); } + /// + /// mes 检验完后通知wms(销售) 回调接口 + /// + /// + /// + /// + [HttpPost] + public async Task MesCheckdSaleCallback(MesCheckdCallbackUpinput input) + { + return await UpdateChackStatus(input); + } + } }