This commit is contained in:
wyw 2025-10-21 08:33:15 +08:00
commit 6eb9727f51
20 changed files with 258646 additions and 14 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,43 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace APT.Data.Migrations.Migrations
{
public partial class hmr2025102001 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<int>(
name: "ROW_NO",
table: "T_SK_ENTERPRISE_LIBRARY_DETAIL_CONTENT_HIDDEN",
type: "int",
nullable: true);
migrationBuilder.AddColumn<int>(
name: "ROW_NO",
table: "T_SK_ENTERPRISE_LIBRARY_DETAIL_CONTENT",
type: "int",
nullable: true);
migrationBuilder.AddColumn<int>(
name: "ROW_NO",
table: "T_SK_ENTERPRISE_LIBRARY_DETAIL",
type: "int",
nullable: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "ROW_NO",
table: "T_SK_ENTERPRISE_LIBRARY_DETAIL_CONTENT_HIDDEN");
migrationBuilder.DropColumn(
name: "ROW_NO",
table: "T_SK_ENTERPRISE_LIBRARY_DETAIL_CONTENT");
migrationBuilder.DropColumn(
name: "ROW_NO",
table: "T_SK_ENTERPRISE_LIBRARY_DETAIL");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,43 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace APT.Data.Migrations.Migrations
{
public partial class hmr2025102002 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<int>(
name: "ROW_NO",
table: "T_SK_BASIC_LIBRARY_DETAIL_CONTENT_HIDDEN",
type: "int",
nullable: true);
migrationBuilder.AddColumn<int>(
name: "ROW_NO",
table: "T_SK_BASIC_LIBRARY_DETAIL_CONTENT",
type: "int",
nullable: true);
migrationBuilder.AddColumn<int>(
name: "ROW_NO",
table: "T_SK_BASIC_LIBRARY_DETAIL",
type: "int",
nullable: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "ROW_NO",
table: "T_SK_BASIC_LIBRARY_DETAIL_CONTENT_HIDDEN");
migrationBuilder.DropColumn(
name: "ROW_NO",
table: "T_SK_BASIC_LIBRARY_DETAIL_CONTENT");
migrationBuilder.DropColumn(
name: "ROW_NO",
table: "T_SK_BASIC_LIBRARY_DETAIL");
}
}
}

View File

@ -72082,6 +72082,9 @@ namespace APT.Data.Migrations.Migrations
.IsRequired()
.HasColumnType("uniqueidentifier");
b.Property<int?>("ROW_NO")
.HasColumnType("int");
b.HasKey("ID");
b.HasIndex("BASIC_LIBRARY_ID");
@ -72152,6 +72155,9 @@ namespace APT.Data.Migrations.Migrations
.IsRequired()
.HasColumnType("uniqueidentifier");
b.Property<int?>("ROW_NO")
.HasColumnType("int");
b.HasKey("ID");
b.HasIndex("BASIC_LIBRARY_DETAIL_ID");
@ -72280,6 +72286,9 @@ namespace APT.Data.Migrations.Migrations
.HasMaxLength(500)
.HasColumnType("nvarchar(500)");
b.Property<int?>("ROW_NO")
.HasColumnType("int");
b.HasKey("ID");
b.HasIndex("BASIC_LIBRARY_DETAIL_CONTENT_ID");
@ -74525,6 +74534,9 @@ namespace APT.Data.Migrations.Migrations
.IsRequired()
.HasColumnType("uniqueidentifier");
b.Property<int?>("ROW_NO")
.HasColumnType("int");
b.HasKey("ID");
b.HasIndex("ENTERPRISE_LIBRARY_ID");
@ -74595,6 +74607,9 @@ namespace APT.Data.Migrations.Migrations
.IsRequired()
.HasColumnType("uniqueidentifier");
b.Property<int?>("ROW_NO")
.HasColumnType("int");
b.HasKey("ID");
b.HasIndex("CHECK_CONTENTS_ID");
@ -74794,6 +74809,9 @@ namespace APT.Data.Migrations.Migrations
.HasMaxLength(500)
.HasColumnType("nvarchar(500)");
b.Property<int?>("ROW_NO")
.HasColumnType("int");
b.HasKey("ID");
b.HasIndex("CHECK_QUESTION_ID");

View File

@ -12373,6 +12373,8 @@ builder.HasOne(t => t.Nav_Law).WithMany().HasForeignKey(t => t.LAW_ID).OnDelete(
builder.Property(t => t.DESCREPTION).HasMaxLength(500);
builder.Property(t => t.DEMAND).HasMaxLength(500);
builder.Ignore(t => t.QUESTION_LEVEL_SHOW);
builder.Ignore(t => t.CHECKCONTENT);
builder.Ignore(t => t.PRODUCTION_UNIT_ID);
}
}
#endregion
@ -13488,6 +13490,8 @@ builder.HasOne(t => t.Nav_CheckType).WithMany().HasForeignKey(t => t.CHECK_TYPE_
builder.Property(t => t.RUNDATA).HasMaxLength(500);
builder.HasOne(t => t.Nav_ProductionUnit).WithMany().HasForeignKey(t => t.PRODUCTION_UNIT_ID).OnDelete(DeleteBehavior.Restrict);
builder.HasOne(t => t.Nav_UserSend).WithMany().HasForeignKey(t => t.USER_ID_SEND).OnDelete(DeleteBehavior.Restrict);
builder.Ignore(t => t.MONTHStr);
builder.Ignore(t => t.DATAStr);
}
}
#endregion
@ -14248,6 +14252,8 @@ builder.HasOne(t => t.Nav_ImgFile).WithMany().HasForeignKey(t => t.IMG_FILE_ID).
base.Configure(builder);
builder.Property(t => t.CODE).HasMaxLength(500);
builder.Property(t => t.NAME).HasMaxLength(500);
builder.Ignore(t => t.MONTHStr);
builder.Ignore(t => t.DATAStr);
}
}
#endregion

View File

@ -42,6 +42,9 @@ namespace APT.MS.Domain.Entities.SK
/// </summary>
[Description("检查内容")]
[FormFieldEdit]
public ICollection<T_SK_BASIC_LIBRARY_DETAIL_CONTENT> Nav_DetailContents { get; set; }
public ICollection<T_SK_BASIC_LIBRARY_DETAIL_CONTENT> Nav_DetailContents { get; set; }
[Description("顺序")]
public int? ROW_NO { get; set; }
}
}

View File

@ -71,6 +71,9 @@ namespace APT.MS.Domain.Entities.SK
/// </summary>
[Description("检查依据")]
[FormFieldEdit]
public ICollection<T_SK_BASIC_LIBRARY_DETAIL_CONTENT_BASIC> Nav_DetailBasics { get; set; }
public ICollection<T_SK_BASIC_LIBRARY_DETAIL_CONTENT_BASIC> Nav_DetailBasics { get; set; }
[Description("顺序")]
public int? ROW_NO { get; set; }
}
}

View File

@ -56,6 +56,8 @@ namespace APT.MS.Domain.Entities.SK
/// 顺序
/// </summary>
[Description("顺序")]
public int? NUM { get; set; }
public int? NUM { get; set; }
[Description("顺序")]
public int? ROW_NO { get; set; }
}
}

View File

@ -68,6 +68,15 @@ namespace APT.MS.Domain.Entities.SK
/// </summary>
[Description("排序号")]
[FormFieldEdit]
public int NUM { get; set; }
public int NUM { get; set; }
[Description("检查内容")]
[DataFieldIngore]
public string CHECKCONTENT { get; set; }
[Description("生产单元")]
[DataFieldIngore]
public Guid? PRODUCTION_UNIT_ID { get; set; }
}
}

View File

@ -47,5 +47,8 @@ namespace APT.MS.Domain.Entities.SK
[Description("检查内容")]
[FormFieldEdit]
public ICollection<T_SK_ENTERPRISE_LIBRARY_DETAIL_CONTENT> Nav_DetailContents { get; set; }
[Description("顺序")]
public int? ROW_NO { get; set; }
}
}

View File

@ -104,5 +104,8 @@ namespace APT.MS.Domain.Entities.SK
[DataFieldIngore]
public string RISK_NAME { get; set; }
[Description("顺序")]
public int? ROW_NO { get; set; }
}
}

View File

@ -54,6 +54,12 @@ namespace APT.MS.Domain.Entities.SK
/// 顺序
/// </summary>
[Description("顺序")]
public int? NUM { get; set; }
public int? NUM { get; set; }
/// <summary>
/// 顺序
/// </summary>
[Description("顺序")]
public int? ROW_NO { get; set; }
}
}

View File

@ -152,7 +152,10 @@ namespace APT.MS.Domain.Entities.SK
/// 接收人
/// </summary>
[Description("接收人")]
public virtual T_FM_USER Nav_UserSend { get; set; }
public virtual T_FM_USER Nav_UserSend { get; set; }
[DataFieldIngore]
public string MONTHStr { get; set; }
[DataFieldIngore]
public string DATAStr { get; set; }
}
}

View File

@ -73,6 +73,11 @@ namespace APT.MS.Domain.Entities.SK
[Description("启用标志")]
[FormFieldTable]
[FormFieldEdit]
public FMEnableStatusEnum ENABLE_STATUS { get; set; }
public FMEnableStatusEnum ENABLE_STATUS { get; set; }
[DataFieldIngore]
public string MONTHStr { get; set; }
[DataFieldIngore]
public string DATAStr { get; set; }
}
}

View File

@ -53,7 +53,8 @@ namespace APT.SK.WebApi.Controllers
foreach (var item3 in item2.Nav_DetailHiddens)
{
item3.ORG_ID = entity.ORG_ID;
item3.BASIC_LIBRARY_DETAIL_CONTENT_ID = item2.ID;
item3.BASIC_LIBRARY_DETAIL_CONTENT_ID = item2.ID;
item3.NUM = (item3.NUM == 0 || item3.NUM == null) ? item3.ROW_NO : item3.NUM;
hiddenList.Add(item3);
}
}
@ -69,13 +70,15 @@ namespace APT.SK.WebApi.Controllers
item2.ORG_ID = entity.ORG_ID;
item2.BASIC_LIBRARY_DETAIL_ID = item.ID;
item2.Nav_DetailHiddens = null;
item2.Nav_DetailBasics = null;
item2.Nav_DetailBasics = null;
item2.NUM = (item2.NUM == 0 || item2.NUM == null) ? item2.ROW_NO : item2.NUM;
contentList.Add(item2);
}
}
item.ORG_ID = entity.ORG_ID;
item.BASIC_LIBRARY_ID = entity.ID;
item.Nav_DetailContents = null;
item.NUM = (item.NUM == 0 || item.NUM == null) ? item.ROW_NO : item.NUM;
}
}
List<Guid> libraryIds = new List<Guid>();

View File

@ -10,12 +10,15 @@ using ICSharpCode.SharpZipLib.Core;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.DependencyModel;
using NPOI.SS.Formula.Functions;
using NPOI.Util;
using Org.BouncyCastle.Asn1.Ess;
using System;
using System.Collections.Generic;
using System.Data;
using System.IO;
using System.Linq;
using System.Reflection.Metadata;
using Ubiety.Dns.Core;
namespace APT.SK.WebApi.Controllers.Api
@ -152,7 +155,7 @@ namespace APT.SK.WebApi.Controllers.Api
startRowIndexs.Add(0, 1);//根据Excel格式数据赋值
var dataTables = FileUtils.ReadExcelByOledb(filePath, startRowIndexs);
string Msg = string.Empty;
isOK = InsertModel(dataTables.Tables[0], orgId, ref Msg);
isOK = InsertModel2(dataTables.Tables[0], orgId, ref Msg);
try
{
@ -327,6 +330,124 @@ namespace APT.SK.WebApi.Controllers.Api
Msg = "导入成功!";
}
return true;
}
/// <summary>
/// 导入
/// </summary>
/// <param name="dtSource"></param>
/// <param name="orgId"></param>
/// <param name="Msg"></param>
/// <param name="rowIndex"></param>
/// <returns></returns>
/// <exception cref="Exception"></exception>
public bool InsertModel2(DataTable dtSource, Guid? orgId, ref string Msg, int rowIndex = 1)
{
var userId = APT.Infrastructure.Api.AppContext.CurrentSession.UserID;
if (dtSource == null || dtSource.Rows.Count < rowIndex)
{
Msg = "未获取到导入数据";
throw new Exception(Msg);
}
int rowAll = dtSource.Rows.Count;
if (rowAll == 1)
{
throw new Exception("导入必须两条以上,一条请直接新增");
}
List<T_SK_CHECK_CONTENTS> contents = new List<T_SK_CHECK_CONTENTS>();
List<T_SK_CHECK_QUESTION> qustions = new List<T_SK_CHECK_QUESTION>();
var baseFilter = new BaseFilter(orgId);
var productionUnits = this.GetEntities<T_FM_USER_PRODUCTION_UNIT_SET>(i => i.IS_DELETED == false, baseFilter);
var oldContents = this.GetEntities<T_SK_CHECK_CONTENTS>(i => i.IS_DELETED == false, baseFilter, "Nav_ListCheckQuestion");
for (int i = 0; i < rowAll; i++)
{
if (!string.IsNullOrEmpty(dtSource.Rows[i][0].ToString().Trim()))
{
var unit = productionUnits.FirstOrDefault(t => t.NAME == dtSource.Rows[i][0].ToString().Trim());
var first = oldContents.FirstOrDefault(x =>x.PRODUCTION_UNIT_ID == unit?.ID && x.CHECKCONTENT == dtSource.Rows[i][1].ToString().Trim());
if (first != null)//旧表已存在数据
{
T_SK_CHECK_QUESTION content = new T_SK_CHECK_QUESTION();
content.ORG_ID = orgId;
content.CHECKCONTENT = dtSource.Rows[i][1].ToString().Trim();
content.DESCREPTION = dtSource.Rows[i][2].ToString().Trim();
content.QUESTION_LEVEL_SHOW = dtSource.Rows[i][3].ToString().Trim();
content.QUESTION_LEVEL = content.QUESTION_LEVEL_SHOW == "重大" ? SKHiddenLevel.Major : SKHiddenLevel.General;
content.DEMAND = dtSource.Rows[i][4].ToString().Trim();
content.PRODUCTION_UNIT_ID = unit?.ID;
content.CHECK_CONTENTS_ID = first.ID;
qustions.Add(content);
}
else
{
T_SK_CHECK_QUESTION content = new T_SK_CHECK_QUESTION();
content.ORG_ID = orgId;
content.CHECKCONTENT = dtSource.Rows[i][1].ToString().Trim();
content.DESCREPTION = dtSource.Rows[i][2].ToString().Trim();
content.QUESTION_LEVEL_SHOW = dtSource.Rows[i][3].ToString().Trim();
content.QUESTION_LEVEL = content.QUESTION_LEVEL_SHOW == "重大" ? SKHiddenLevel.Major : SKHiddenLevel.General;
content.DEMAND = dtSource.Rows[i][4].ToString().Trim();
content.PRODUCTION_UNIT_ID = unit?.ID;
qustions.Add(content);
}
}
}
if (qustions != null && qustions.Any())
{
var contentList2 = qustions.Where(m => m.CHECK_CONTENTS_ID != null).GroupBy(t => new { t.CHECK_CONTENTS_ID, t.PRODUCTION_UNIT_ID, t.CHECKCONTENT }).Distinct().ToList();
if (contentList2 != null && contentList2.Any())
{
foreach (var item in contentList2)
{
var qus = qustions.Where(t => t.CHECK_CONTENTS_ID == item.Key.CHECK_CONTENTS_ID && t.PRODUCTION_UNIT_ID == item.Key.PRODUCTION_UNIT_ID && t.CHECKCONTENT == item.Key.CHECKCONTENT).ToList();
var j = 1;
foreach (var qu in qus)
{
qu.NUM = j;
j++;
}
}
}
var contentList = qustions.Where(m=>m.CHECK_CONTENTS_ID==null).GroupBy(t => new { t.PRODUCTION_UNIT_ID, t.CHECKCONTENT }).Distinct().ToList();
if (contentList != null && contentList.Any())
{
foreach (var item in contentList)
{
T_SK_CHECK_CONTENTS content = new T_SK_CHECK_CONTENTS();
content.ORG_ID = orgId;
content.PRODUCTION_UNIT_ID = item.Key.PRODUCTION_UNIT_ID;
content.CHECKCONTENT = item.Key.CHECKCONTENT;
contents.Add(content);
var qus = qustions.Where(t => t.PRODUCTION_UNIT_ID == item.Key.PRODUCTION_UNIT_ID && t.CHECKCONTENT == item.Key.CHECKCONTENT).ToList();
var j = 1;
foreach (var qu in qus)
{
qu.CHECK_CONTENTS_ID = content.ID;
qu.NUM = j;
j++;
}
}
}
}
if (!string.IsNullOrEmpty(Msg))
{
throw new Exception(Msg);
}
else
{
UnifiedCommit(() =>
{
if (contents != null && contents.Any())
BantchSaveEntityNoCommit(contents);
if (qustions != null && qustions.Any())
BantchSaveEntityNoCommit(qustions);
});
Msg = "导入成功!";
}
return true;
}
}
}

View File

@ -199,7 +199,7 @@ namespace APT.SK.WebApi.Controllers.Api
de.ENTERPRISE_LIBRARY_ID = entity.ID;
de.MEASURES_NAME = item.MEASURES_NAME;
de.EMERGENCY = item.EMERGENCY;
de.NUM = item.NUM;
de.NUM = (item.NUM == 0 || item.NUM == null) ? item.ROW_NO : item.NUM;
libraryDetail.Add(de);
if (item.Nav_DetailContents != null && item.Nav_DetailContents.Any())
{
@ -213,7 +213,7 @@ namespace APT.SK.WebApi.Controllers.Api
con.CHECK_CONTENT = item2.CHECK_CONTENT;
con.CHECK_BASIC = item2.CHECK_BASIC;
con.CHECK_STANDARD = item2.CHECK_STANDARD;
con.NUM = item2.NUM;
con.NUM = (item2.NUM == 0 || item2.NUM == null) ? item2.ROW_NO : item2.NUM;
contentList.Add(con);
if (item2.Nav_DetailHiddens != null && item2.Nav_DetailHiddens.Any())
{
@ -227,7 +227,7 @@ namespace APT.SK.WebApi.Controllers.Api
hi.HIDDEN_DESCRIPTION = item3.HIDDEN_DESCRIPTION;
hi.HIDDEN_LEVEL = item3.HIDDEN_LEVEL;
hi.RECTIFICATION_MEASURES = item3.RECTIFICATION_MEASURES;
hi.NUM = item3.NUM;
hi.NUM =(item3.NUM ==0 || item3.NUM == null)?item3.ROW_NO:item3.NUM;
hiddenList.Add(hi);
}
}

View File

@ -68,6 +68,31 @@ namespace APT.SK.WebApi.Controllers.Api
});
return true;
});
}
/// <summary>
/// 排序分页查询数据
/// </summary>
/// <param name="pageFilter">分页过滤实体</param>
/// <returns></returns>
[HttpPost, Route("SKOrderPaged")]
public PagedActionResult<T_SK_PLAN_SET> SKOrderPaged([FromBody] KeywordPageFilter pageFilter)
{
var result = this.GetOrderPageEntities<T_SK_PLAN_SET>(null, pageFilter);
if (result != null && result.Data != null && result.Data.Any())
{
result.Data.ForEach(t =>
{
if (t.MONTH == null || t.MONTH == 0)
{
t.MONTHStr = "--";
}
if (t.DATA == null || t.DATA == 0)
{
t.DATAStr = "--";
}
});
}
return result;
}
}
}

View File

@ -4,6 +4,7 @@ using APT.MS.Domain.Enums;
using APT.MS.Domain.Enums.SK;
using APT.Utility;
using Microsoft.AspNetCore.Mvc;
using System.Linq;
namespace APT.SK.WebApi.Controllers.Api
{
@ -62,6 +63,32 @@ namespace APT.SK.WebApi.Controllers.Api
});
return true;
});
}
/// <summary>
/// 排序分页查询数据
/// </summary>
/// <param name="pageFilter">分页过滤实体</param>
/// <returns></returns>
[HttpPost, Route("SKOrderPaged")]
public PagedActionResult<T_SK_TIME_SET> SKOrderPaged([FromBody] KeywordPageFilter pageFilter)
{
var result = this.GetOrderPageEntities<T_SK_TIME_SET>(null, pageFilter);
if (result != null && result.Data != null && result.Data.Any())
{
result.Data.ForEach(t =>
{
if (t.MONTH == null || t.MONTH == 0)
{
t.MONTHStr = "--";
}
if (t.DATA == null || t.DATA == 0)
{
t.DATAStr = "--";
}
});
}
return result;
}
}
}