导入模板去除适用岗位:题库 课件库

This commit is contained in:
wyw 2026-04-08 17:19:56 +08:00
parent 624ff25360
commit 462bdf624f
2 changed files with 64 additions and 63 deletions

View File

@ -737,38 +737,38 @@ namespace APT.SE.WebApi.Controllers.Api
}
sub1sPer = new List<T_SE_TEST_LIST_POST>();
sub2sPer = new List<T_SE_TEST_LIST_POINT>();
//if (!string.IsNullOrEmpty(dtSource.Rows[i][9].ToString().Trim()))
//{
// var testPosts = dtSource.Rows[i][9].ToString().Trim().Split(';');
// foreach (var postName in testPosts)
// {
// if (!string.IsNullOrEmpty(postName))
// {
// modelPost = posts.FirstOrDefault(t => t.NAME == postName);
// if (modelPost == null)
// {
// if (!listPostNameEmpty.Contains(postName))
// listPostNameEmpty.Add(postName);
// }
// else
// {
// T_SE_TEST_LIST_POST sub1 = new T_SE_TEST_LIST_POST
// {
// ID = Guid.NewGuid(),
// ORG_ID = orgId,
// TEST_ID = mainTable.ID,
// POST_ID = posts.FirstOrDefault(t => t.NAME == postName).ID
// };
// sub1sPer.Add(sub1);
// }
// }
// }
//}
if (!string.IsNullOrEmpty(dtSource.Rows[i][9].ToString().Trim()))
{
var testPosts = dtSource.Rows[i][9].ToString().Trim().Split(';');
foreach (var postName in testPosts)
{
if (!string.IsNullOrEmpty(postName))
{
modelPost = posts.FirstOrDefault(t => t.NAME == postName);
if (modelPost == null)
{
if (!listPostNameEmpty.Contains(postName))
listPostNameEmpty.Add(postName);
}
else
{
T_SE_TEST_LIST_POST sub1 = new T_SE_TEST_LIST_POST
{
ID = Guid.NewGuid(),
ORG_ID = orgId,
TEST_ID = mainTable.ID,
POST_ID = posts.FirstOrDefault(t => t.NAME == postName).ID
};
sub1sPer.Add(sub1);
}
}
}
}
if (!string.IsNullOrEmpty(dtSource.Rows[i][10].ToString().Trim()))
{
var testPoints = dtSource.Rows[i][10].ToString().Trim().Split(';');
var testPoints = dtSource.Rows[i][9].ToString().Trim().Split(';');
foreach (var pointName in testPoints)
{
if (!string.IsNullOrEmpty(pointName))
@ -798,9 +798,9 @@ namespace APT.SE.WebApi.Controllers.Api
if (sub2sPer != null && sub2sPer.Count > 0)
sub2s.AddRange(sub2sPer);
if (!string.IsNullOrEmpty(dtSource.Rows[i][11].ToString().Trim()))
if (!string.IsNullOrEmpty(dtSource.Rows[i][10].ToString().Trim()))
{
mainTable.TRAINNAME = dtSource.Rows[i][11].ToString().Trim();
mainTable.TRAINNAME = dtSource.Rows[i][10].ToString().Trim();
}
mainTables.Add((T_SE_TEST)mainTable.Clone());

View File

@ -325,13 +325,14 @@ namespace APT.SE.WebApi.Controllers.Api
/// <exception cref="Exception"></exception>
public bool InsertModel(DataTable dtSource, Guid? orgId, ref string Msg, int rowIndex = 1)
{
//适用岗位去除 列9
var userId = APT.Infrastructure.Api.AppContext.CurrentSession.UserID;
if (dtSource == null || dtSource.Rows.Count < rowIndex)
{
Msg = "未获取到导入数据";
throw new Exception(Msg);
}
List<int> listNotEmpty = new List<int>() { 0, 1, 7, 8, 10 };
List<int> listNotEmpty = new List<int>() { 0, 1, 7, 8, 9 };// 10 =>9
Dictionary<int, List<int>> dicIndexEmpty = new Dictionary<int, List<int>>();
int rowAll = dtSource.Rows.Count;
int colAll = dtSource.Columns.Count;
@ -562,36 +563,36 @@ namespace APT.SE.WebApi.Controllers.Api
}
mainTable.USAGE = k;
}
//if (!string.IsNullOrEmpty(dtSource.Rows[i][9].ToString().Trim()))
//{
// var testPosts = dtSource.Rows[i][9].ToString().Trim().Split(';');
// foreach (var postName in testPosts)
// {
// if (!string.IsNullOrEmpty(postName))
// {
// modelPost = posts.FirstOrDefault(t => t.NAME == postName);
// if (modelPost == null)
// {
// if (!listPostNameEmpty.Contains(postName))
// listPostNameEmpty.Add(postName);
// }
// else
// {
// T_SE_TEST_LIST_POST sub1 = new T_SE_TEST_LIST_POST
// {
// ID = Guid.NewGuid(),
// ORG_ID = orgId,
// TEST_ID = mainTable.ID,
// POST_ID = posts.FirstOrDefault(t => t.NAME == postName).ID
// };
// sub1s.Add(sub1);
// }
// }
// }
//}
if (!string.IsNullOrEmpty(dtSource.Rows[i][9].ToString().Trim()))
{
var testPosts = dtSource.Rows[i][9].ToString().Trim().Split(';');
foreach (var postName in testPosts)
{
if (!string.IsNullOrEmpty(postName))
{
modelPost = posts.FirstOrDefault(t => t.NAME == postName);
if (modelPost == null)
{
if (!listPostNameEmpty.Contains(postName))
listPostNameEmpty.Add(postName);
}
else
{
T_SE_TEST_LIST_POST sub1 = new T_SE_TEST_LIST_POST
{
ID = Guid.NewGuid(),
ORG_ID = orgId,
TEST_ID = mainTable.ID,
POST_ID = posts.FirstOrDefault(t => t.NAME == postName).ID
};
sub1s.Add(sub1);
}
}
}
}
if (!string.IsNullOrEmpty(dtSource.Rows[i][10].ToString().Trim()))
{
var testPoints = dtSource.Rows[i][10].ToString().Trim().Split(';');
var testPoints = dtSource.Rows[i][9].ToString().Trim().Split(';');
foreach (var pointName in testPoints)
{
if (!string.IsNullOrEmpty(pointName))
@ -616,9 +617,9 @@ namespace APT.SE.WebApi.Controllers.Api
}
}
}
if (!string.IsNullOrEmpty(dtSource.Rows[i][11].ToString().Trim()))
if (!string.IsNullOrEmpty(dtSource.Rows[i][10].ToString().Trim()))
{
mainTable.TRAINNAME = dtSource.Rows[i][11].ToString().Trim();
mainTable.TRAINNAME = dtSource.Rows[i][10].ToString().Trim();
}
mainTables.Add(mainTable);
}