From 11c326b2003645f057df4086cb2450e6b658656f Mon Sep 17 00:00:00 2001 From: Tiobon Date: Mon, 14 Apr 2025 15:09:25 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=96=E8=AE=AD=E7=94=B3=E8=AF=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...xternalTrainApplyOrder_Boltone.Dto.Base.cs | 11 ++-- .../ViewModels/Extend/Ghre_Attachment1.cs | 10 ++++ Tiobon.Core.Services/CommonServices.cs | 50 +++++++++++++++++-- 3 files changed, 65 insertions(+), 6 deletions(-) create mode 100644 Tiobon.Core.Model/ViewModels/Extend/Ghre_Attachment1.cs diff --git a/Tiobon.Core.Model/Base/Ghre/Ghre_ExternalTrainApplyOrder_Boltone.Dto.Base.cs b/Tiobon.Core.Model/Base/Ghre/Ghre_ExternalTrainApplyOrder_Boltone.Dto.Base.cs index ecf2c5cb..f9fa1030 100644 --- a/Tiobon.Core.Model/Base/Ghre/Ghre_ExternalTrainApplyOrder_Boltone.Dto.Base.cs +++ b/Tiobon.Core.Model/Base/Ghre/Ghre_ExternalTrainApplyOrder_Boltone.Dto.Base.cs @@ -14,6 +14,8 @@ *│ 作者:SimonHsiao │ *└──────────────────────────────────┘ */ +using Tiobon.Core.Model.ViewModels.Extend; + namespace Tiobon.Core.Model.Models; @@ -317,9 +319,12 @@ public class Ghre_ExternalTrainApplyOrder_BoltoneBase /// public int? ReverseI2 { get; set; } - public List ExternalAttachments { get; set; } = new List(); + public List ExternalAttachments { get; set; } = new List(); + + public List ContractAttachments { get; set; } = new List(); - public List ContractAttachments { get; set; } = new List(); + public List Attachments { get; set; } = new List(); - public List Attachments { get; set; } = new List(); + public string AttachmentTemplateLink { get; set; } = "/Advanced/files/外训申请附件.zip" +; } diff --git a/Tiobon.Core.Model/ViewModels/Extend/Ghre_Attachment1.cs b/Tiobon.Core.Model/ViewModels/Extend/Ghre_Attachment1.cs new file mode 100644 index 00000000..41ee833c --- /dev/null +++ b/Tiobon.Core.Model/ViewModels/Extend/Ghre_Attachment1.cs @@ -0,0 +1,10 @@ +using Tiobon.Core.Model.Models; + +namespace Tiobon.Core.Model.ViewModels.Extend; + + + +public class Ghre_Attachment1 : Ghre_Attachment +{ + public long? AttachmentID { get; set; } +} diff --git a/Tiobon.Core.Services/CommonServices.cs b/Tiobon.Core.Services/CommonServices.cs index 99f41ad3..e26f03f7 100644 --- a/Tiobon.Core.Services/CommonServices.cs +++ b/Tiobon.Core.Services/CommonServices.cs @@ -1,5 +1,5 @@ using Microsoft.AspNetCore.Mvc; -using SqlSugar.Extensions; +using System.IO; using System.Text.RegularExpressions; namespace Tiobon.Core.Services; @@ -4242,7 +4242,7 @@ public partial class CommonServices : BaseServices>, ICommon break; - case "F_ESS_ExternalTrainApply_Boltone": //外训申请_宝连通 + case "F_ESS_ExternalTrainApplyOrder_Boltone": //外训申请_宝连通 #region 写入数据,并判断是否有错误 switch (param.doType) @@ -4253,15 +4253,59 @@ public partial class CommonServices : BaseServices>, ICommon #region 写入数据,并判断是否有错误 string json = param.jsonParam.ToString(); var dict = JsonHelper.JsonToObj(json); + var dict1 = JsonHelper.JsonToObj(json); //dict.RequestNo = await GenerateContinuousSequence("Ghrh_HumanRequest", "RequestNo", "R"); id = await Db.Insertable(dict).ExecuteReturnSnowflakeIdAsync(); - sql = $"SELECT ISNULL(MAX(id)+1,1) FROM Ghre_ExternalTrainApplyOrder_Boltone WHERE Id !='{id}'"; + + + sql = $"SELECT ISNULL(MAX(id)+1,1) FROM Ghre_ExternalTrainApplyOrder_Boltone WHERE Id !='{id}' and len(Id) !=19"; var id1 = await Db.Ado.GetLongAsync(sql); sql = $"UPDATE Ghre_ExternalTrainApplyOrder_Boltone SET Id={id1} WHERE Id ='{id}'"; await Db.Ado.ExecuteCommandAsync(sql); id = id1; + + if (dict1.Attachments.Any()) + { + var ids = dict1.Attachments.Select(x => x.AttachmentID).ToList(); + await Db.Updateable() + .SetColumns(it => new Ghre_Attachment() + { + TableName = "Ghre_ExternalTrainApplyOrder_Boltone", + TableKeyID = id.ObjToInt(), + Reverse1 = "Attachments" + }) + .Where(it => ids.Contains(it.Id)) + .ExecuteCommandAsync(); + } + if (dict1.ContractAttachments.Any()) + { + var ids = dict1.ContractAttachments.Select(x => x.AttachmentID).ToList(); + await Db.Updateable() + .SetColumns(it => new Ghre_Attachment() + { + TableName = "Ghre_ExternalTrainApplyOrder_Boltone", + TableKeyID = id.ObjToInt(), + Reverse1 = "ContractAttachments" + }) + .Where(it => ids.Contains(it.Id)) + .ExecuteCommandAsync(); + } + + if (dict1.ExternalAttachments.Any()) + { + var ids = dict1.ExternalAttachments.Select(x => x.AttachmentID).ToList(); + await Db.Updateable() + .SetColumns(it => new Ghre_Attachment() + { + TableName = "Ghre_ExternalTrainApplyOrder_Boltone", + TableKeyID = id.ObjToInt(), + Reverse1 = "ExternalAttachments" + }) + .Where(it => ids.Contains(it.Id)) + .ExecuteCommandAsync(); + } #endregion break;