😎OA创建问题报告、增加上位负责人(OA工号)字段

This commit is contained in:
bairubing 2025-01-15 15:13:58 +08:00
parent ef71855c8b
commit e29ab3ca32
3 changed files with 57 additions and 7 deletions

View File

@ -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; }
/// <summary>
///
/// </summary>
[SugarColumn(ColumnName = "fld007039", ColumnDescription = "")]
public long? fld007039 { get; set; }
/// <summary>
///
/// </summary>
[SugarColumn(ColumnName = "fld007039_Rec", ColumnDescription = "", Length = -1)]
public string? fld007039_Rec { get; set; }
}

View File

@ -132,4 +132,9 @@ public class OaCreateProcessInput
/// 软件问题处理人员
/// </summary>
public string fld006062 { get; set; }
/// <summary>
/// 上位负责人OA工号
/// </summary>
public string fld007040 { get; set; }
}

View File

@ -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<FieldGroupDefault> _fieldGroupDefaultRep;
public SqlSugarRepository<Obj81> _obj81Rep;
public SqlSugarRepository<Obj118> _obj118Rep;
private readonly IServiceScopeFactory _scopeFactory;
public OaOpenInterfaceService(
SqlSugarRepository<Obj109> obj109Rep,
@ -52,7 +55,8 @@ public class OaOpenInterfaceService : IDynamicApiController, ITransient
SolidWorksManageService.SolidWorksManageService solidWorksManageService,
SqlSugarRepository<ObjectFieldsGroups> objectFieldsGroupsRep,
SqlSugarRepository<FieldGroupDefault> fieldGroupDefaultRep,
SqlSugarRepository<Obj118> obj118Rep
SqlSugarRepository<Obj118> obj118Rep,
IServiceScopeFactory scopeFactory
)
{
@ -63,6 +67,7 @@ public class OaOpenInterfaceService : IDynamicApiController, ITransient
_fieldGroupDefaultRep = fieldGroupDefaultRep;
_obj81Rep= obj81Rep;
_obj118Rep= obj118Rep;
_scopeFactory = scopeFactory;
}
/// <summary>
@ -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<List<OaUploadFileOutput>> 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<ISqlSugarClient>().AsTenant().GetConnectionScope("启威星 1.94.4.74").CopyNew();
var data=await db.CopyNew().Queryable<Obj118>().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<Obj140>().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<Obj118>()
.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
/// <returns></returns>
public async Task<OaUploadFileOutput> 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
{