Commit cb792f31 by jiawei.su
parents 218d7fcb 21ff333f
...@@ -186,28 +186,34 @@ namespace Siger.Middlelayer.AccRepository.Repositories ...@@ -186,28 +186,34 @@ namespace Siger.Middlelayer.AccRepository.Repositories
if (string.IsNullOrEmpty(item.ParentFixtureTool)) if (string.IsNullOrEmpty(item.ParentFixtureTool))
{ {
errors.Add($"{rowIndex},{(int)RequestEnum.PleaseInputParentFixtureCode}"); errors.Add($"{rowIndex},{(int)RequestEnum.PleaseInputParentFixtureCode}");
return new CommonImportResult(0, string.Join(";", errors));
} }
if (string.IsNullOrEmpty(item.FixtureTool)) if (string.IsNullOrEmpty(item.FixtureTool))
{ {
errors.Add($"{rowIndex},{(int)RequestEnum.PleaseInputSonFixtureCode}"); errors.Add($"{rowIndex},{(int)RequestEnum.PleaseInputSonFixtureCode}");
return new CommonImportResult(0, string.Join(";", errors));
} }
if (string.IsNullOrEmpty(item.Status)) if (string.IsNullOrEmpty(item.Status))
{ {
errors.Add($"{rowIndex},{(int)RequestEnum.PleaseInputStatus}"); errors.Add($"{rowIndex},{(int)RequestEnum.PleaseInputStatus}");
return new CommonImportResult(0, string.Join(";", errors));
} }
if (item.ParentFixtureTool == item.FixtureTool) if (item.ParentFixtureTool == item.FixtureTool)
{ {
errors.Add($"{rowIndex},{(int)RequestEnum.ParentSonSame}"); errors.Add($"{rowIndex},{(int)RequestEnum.ParentSonSame}");
return new CommonImportResult(0, string.Join(";", errors));
} }
var parent = _context.siger_automation_fixture_tools.FirstOrDefault(q => q.code == item.ParentFixtureTool && q.projectId == projectid); var parent = _context.siger_automation_fixture_tools.FirstOrDefault(q => q.code == item.ParentFixtureTool && q.projectId == projectid);
if (parent == null) if (parent == null)
{ {
errors.Add($"{rowIndex},{(int)RequestEnum.FixtureToolNotFound}"); errors.Add($"{rowIndex},{(int)RequestEnum.FixtureToolNotFound}");
return new CommonImportResult(0, string.Join(";", errors));
} }
var son = _context.siger_automation_fixture_tools.FirstOrDefault(q => q.code == item.FixtureTool && q.projectId == projectid); var son = _context.siger_automation_fixture_tools.FirstOrDefault(q => q.code == item.FixtureTool && q.projectId == projectid);
if (son == null) if (son == null)
{ {
errors.Add($"{rowIndex},{(int)RequestEnum.FixtureToolNotFound}"); errors.Add($"{rowIndex},{(int)RequestEnum.FixtureToolNotFound}");
return new CommonImportResult(0, string.Join(";", errors));
} }
var parentGuid = parent.guid; var parentGuid = parent.guid;
if(son != null && parent != null) if(son != null && parent != null)
...@@ -216,16 +222,19 @@ namespace Siger.Middlelayer.AccRepository.Repositories ...@@ -216,16 +222,19 @@ namespace Siger.Middlelayer.AccRepository.Repositories
if (exsit != null) if (exsit != null)
{ {
errors.Add($"{rowIndex},{(int)RequestEnum.DataExist}"); errors.Add($"{rowIndex},{(int)RequestEnum.DataExist}");
return new CommonImportResult(0, string.Join(";", errors));
} }
} }
if (list.Count(q => q.FixtureTool == item.FixtureTool && q.ParentFixtureTool == item.ParentFixtureTool) > 1) if (list.Count(q => q.FixtureTool == item.FixtureTool && q.ParentFixtureTool == item.ParentFixtureTool) > 1)
{ {
errors.Add($"{rowIndex},{(int)RequestEnum.DataExist}"); errors.Add($"{rowIndex},{(int)RequestEnum.DataExist}");
return new CommonImportResult(0, string.Join(";", errors));
} }
var parentExsit = _context.siger_automation_fixture_tools_assembly.FirstOrDefault(q => q.projectId == projectid && q.son == parentGuid); var parentExsit = _context.siger_automation_fixture_tools_assembly.FirstOrDefault(q => q.projectId == projectid && q.son == parentGuid);
if (parentExsit != null && !string.IsNullOrEmpty(parentExsit.parent)) if (parentExsit != null && !string.IsNullOrEmpty(parentExsit.parent))
{ {
errors.Add($"{rowIndex},{(int)RequestEnum.LevelCountError}"); errors.Add($"{rowIndex},{(int)RequestEnum.LevelCountError}");
return new CommonImportResult(0, string.Join(";", errors));
} }
if (errors.Any()) if (errors.Any())
......
...@@ -212,7 +212,8 @@ namespace Siger.Middlelayer.AccRepository.Repositories ...@@ -212,7 +212,8 @@ namespace Siger.Middlelayer.AccRepository.Repositories
var entity = new siger_automation_location var entity = new siger_automation_location
{ {
guid = Guid.NewGuid().ToString(), guid = Guid.NewGuid().ToString(),
locationid = location.id, location_cid = location.id,
locationid = location.locationid,
fixturetools = fixturetool.guid, fixturetools = fixturetool.guid,
attachment = "", attachment = "",
filename = "", filename = "",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment