From e29ab3ca325e1d08b3841befde9922d654fe268a Mon Sep 17 00:00:00 2001 From: bairubing Date: Wed, 15 Jan 2025 15:13:58 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=98=8EOA=E5=88=9B=E5=BB=BA=E9=97=AE?= =?UTF-8?q?=E9=A2=98=E6=8A=A5=E5=91=8A=E3=80=81=E5=A2=9E=E5=8A=A0=E4=B8=8A?= =?UTF-8?q?=E4=BD=8D=E8=B4=9F=E8=B4=A3=E4=BA=BA=EF=BC=88OA=E5=B7=A5?= =?UTF-8?q?=E5=8F=B7=EF=BC=89=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Vistar.Application/Entity/Obj140.cs | 15 ++++++- .../Dto/OaCreateProcessInput.cs | 5 +++ .../OaOpenInterface/OaOpenInterfaceService.cs | 44 ++++++++++++++++--- 3 files changed, 57 insertions(+), 7 deletions(-) diff --git a/admin.net.pro/Admin.NET/Vistar.Application/Entity/Obj140.cs b/admin.net.pro/Admin.NET/Vistar.Application/Entity/Obj140.cs index 70cb70f..72ea219 100644 --- a/admin.net.pro/Admin.NET/Vistar.Application/Entity/Obj140.cs +++ b/admin.net.pro/Admin.NET/Vistar.Application/Entity/Obj140.cs @@ -483,5 +483,18 @@ public class Obj140 public string? fld006063_Rec { get; set; } public long ? fld006064 { get; set; } public string? fld006064_Rec { get; set; } - + public string? fld007040 { get; set; } + + /// + /// + /// + [SugarColumn(ColumnName = "fld007039", ColumnDescription = "")] + public long? fld007039 { get; set; } + + /// + /// + /// + [SugarColumn(ColumnName = "fld007039_Rec", ColumnDescription = "", Length = -1)] + public string? fld007039_Rec { get; set; } + } diff --git a/admin.net.pro/Admin.NET/Vistar.Application/Service/OaOpenInterface/Dto/OaCreateProcessInput.cs b/admin.net.pro/Admin.NET/Vistar.Application/Service/OaOpenInterface/Dto/OaCreateProcessInput.cs index 7c00290..83629f1 100644 --- a/admin.net.pro/Admin.NET/Vistar.Application/Service/OaOpenInterface/Dto/OaCreateProcessInput.cs +++ b/admin.net.pro/Admin.NET/Vistar.Application/Service/OaOpenInterface/Dto/OaCreateProcessInput.cs @@ -132,4 +132,9 @@ public class OaCreateProcessInput /// 软件问题处理人员 /// public string fld006062 { get; set; } + + /// + /// 上位负责人(OA工号) + /// + public string fld007040 { get; set; } } diff --git a/admin.net.pro/Admin.NET/Vistar.Application/Service/OaOpenInterface/OaOpenInterfaceService.cs b/admin.net.pro/Admin.NET/Vistar.Application/Service/OaOpenInterface/OaOpenInterfaceService.cs index 3ecc33f..4659204 100644 --- a/admin.net.pro/Admin.NET/Vistar.Application/Service/OaOpenInterface/OaOpenInterfaceService.cs +++ b/admin.net.pro/Admin.NET/Vistar.Application/Service/OaOpenInterface/OaOpenInterfaceService.cs @@ -15,8 +15,10 @@ using Furion.DynamicApiController; using Microsoft.AspNetCore.Authentication.JwtBearer; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.DependencyInjection; using NewLife.Xml; using Newtonsoft.Json; +using SqlSugar; using System; using System.Collections.Generic; using System.ComponentModel; @@ -44,6 +46,7 @@ public class OaOpenInterfaceService : IDynamicApiController, ITransient public SqlSugarRepository _fieldGroupDefaultRep; public SqlSugarRepository _obj81Rep; public SqlSugarRepository _obj118Rep; + private readonly IServiceScopeFactory _scopeFactory; public OaOpenInterfaceService( SqlSugarRepository obj109Rep, @@ -52,7 +55,8 @@ public class OaOpenInterfaceService : IDynamicApiController, ITransient SolidWorksManageService.SolidWorksManageService solidWorksManageService, SqlSugarRepository objectFieldsGroupsRep, SqlSugarRepository fieldGroupDefaultRep, - SqlSugarRepository obj118Rep + SqlSugarRepository obj118Rep, + IServiceScopeFactory scopeFactory ) { @@ -63,6 +67,7 @@ public class OaOpenInterfaceService : IDynamicApiController, ITransient _fieldGroupDefaultRep = fieldGroupDefaultRep; _obj81Rep= obj81Rep; _obj118Rep= obj118Rep; + _scopeFactory = scopeFactory; } /// @@ -223,6 +228,7 @@ public class OaOpenInterfaceService : IDynamicApiController, ITransient fieldList.Add(new Field { key = "fld005852", value = input.fld005852.ToString("yyyy-MM-dd HH:mm:ss") }); fieldList.Add(new Field { key = "fld005853", value = input.fld005853 }); fieldList.Add(new Field { key = "fld005855", value = "OA" }); + fieldList.Add(new Field { key = "fld007040", value = input.fld007040 }); if (!string.IsNullOrWhiteSpace(input.fld005838)) { @@ -278,12 +284,31 @@ public class OaOpenInterfaceService : IDynamicApiController, ITransient var projectData = await _obj140Rep.AsQueryable().Where(x => x._System_objNBS == input._System_objNBS && x.deleted == false).OrderByDescending(x=>x.VersionIndex).FirstAsync(); long? fld005835 = null; string fld005835_Rec = ""; + var responsiblePersonOaData = await _obj81Rep.AsQueryable().Where(x => x.fld004900 == input.fld005836 && x.deleted == false).ToListAsync(); if (responsiblePersonOaData.Count != 0) { fld005835 = 81; fld005835_Rec = responsiblePersonOaData[0].RecordGuid; } + + + long? fld007039 = null; + string fld007039_Rec = ""; + + if (!string.IsNullOrEmpty(input.fld007040)) + { + var responsiblePersonData = await _obj81Rep.AsQueryable().Where(x => x.fld004900 == input.fld007040 && x.deleted == false).ToListAsync(); + + if (responsiblePersonData.Count != 0) + { + fld007039 = 81; + fld007039_Rec = responsiblePersonData[0].RecordGuid; + } + } + + + long? fld005848 = null; string fld005848_Rec = ""; var createPersonOaData = await _obj81Rep.AsQueryable().Where(x => x.fld004900 == input.fld005847 && x.deleted == false).ToListAsync(); @@ -343,6 +368,8 @@ public class OaOpenInterfaceService : IDynamicApiController, ITransient { fld005835 = fld005835, fld005835_Rec= fld005835_Rec, + fld007039 = fld007039, + fld007039_Rec = fld007039_Rec, fld005848 = fld005848, fld005848_Rec = fld005848_Rec, fld005851 = fld005851, @@ -439,7 +466,10 @@ public class OaOpenInterfaceService : IDynamicApiController, ITransient [AllowAnonymous] public async Task> SyncEcnAttach() { - var data=await _obj118Rep.AsQueryable().Where(x=>x.deleted==false&&x.fld006778=="A"&&x._System_CurrentStage=="结束"&&!string.IsNullOrEmpty(x.fld006310_Rec)).ToListAsync(); + using var serviceScope = _scopeFactory.CreateScope(); + var db = serviceScope.ServiceProvider.GetRequiredService().AsTenant().GetConnectionScope("启威星 1.94.4.74").CopyNew(); + + var data=await db.CopyNew().Queryable().Where(x=>x.deleted==false&&x.fld006778=="A"&&x._System_CurrentStage=="结束"&&!string.IsNullOrEmpty(x.fld006310_Rec)).ToListAsync(); var groupedData = data.GroupBy(item => item.RecordGuid) .Select(group => group.OrderByDescending(item => item.idRecord).First()) @@ -456,19 +486,20 @@ public class OaOpenInterfaceService : IDynamicApiController, ITransient var manageOutput= await _solidWorksManageService.ExportRelatedFiles(input); if (manageOutput.State=="成功") { - var problemReport= await _obj140Rep.AsQueryable().Where(x=>x.RecordGuid==item.fld006310_Rec&&x.deleted==false).FirstAsync(); + var problemReport= await db.CopyNew().Queryable().Where(x=>x.RecordGuid==item.fld006310_Rec&&x.deleted==false).FirstAsync(); if (problemReport != null) { var oaUploadFileOutput = await OaUploadFile(problemReport._System_objNBS, manageOutput); output.Add(oaUploadFileOutput); - await _obj118Rep.AsUpdateable().SetColumns(it => new Obj118 + db.CopyNew().Updateable() + .SetColumns(it => new Obj118 { fld006778="N", fld006780=DateTime.Now, fld006779= oaUploadFileOutput.message }) .Where(it => it.idRecord == id) - .ExecuteCommandAsync(); + .ExecuteCommand(); } } } @@ -483,7 +514,8 @@ public class OaOpenInterfaceService : IDynamicApiController, ITransient /// public async Task OaUploadFile(string problemNum, ExportRelatedFilesOutput input) { - string url = "http://223.113.253.60:8000/papi/secondev/workflow/uploadFileByReportNo"; + //string url = "http://223.113.253.60:8000/papi/secondev/workflow/uploadFileByReportNo"; + string url = "http://192.168.10.35:8000/papi/secondev/workflow/uploadFileByReportNo"; // 构建请求参数字典 var requestData = new {