Commit 0c7bd868 by xin.yang

some update

parent ba07d071
...@@ -709,6 +709,17 @@ export default { ...@@ -709,6 +709,17 @@ export default {
'9000484': '数据库创建失败', '9000484': '数据库创建失败',
'9000485': '数据表创建失败', '9000485': '数据表创建失败',
'9000486': '标签来源未维护', '9000486': '标签来源未维护',
'9000487': '只能读取txt文件',
'9000488': '程序版本号不能为空',
'9000489': '存在相同程序号的程序已审核,是否覆盖原来程序记录?',
'9000490': '记录已存在,请删除后添加',
'9000491': '人员未找到',
'9000492': '默认展示已存在',
'9000493': '未找到储位类别',
'9000494': '未找到工装类别',
'9000495': '未找到工装信息',
'9000496': 'ID重复',
'9000497': '父级和子级不能相同',
'9100000': 'Departments cannot be empty', '9100000': 'Departments cannot be empty',
'9100001': 'Position cannot be empty', '9100001': 'Position cannot be empty',
......
...@@ -742,6 +742,11 @@ export default { ...@@ -742,6 +742,11 @@ export default {
'9000490': '记录已存在,请删除后添加', '9000490': '记录已存在,请删除后添加',
'9000491': '人员未找到', '9000491': '人员未找到',
'9000492': '默认展示已存在', '9000492': '默认展示已存在',
'9000493': '未找到储位类别',
'9000494': '未找到工装类别',
'9000495': '未找到工装信息',
'9000496': 'ID重复',
'9000497': '父级和子级不能相同',
'9100000': '部门不能为空', '9100000': '部门不能为空',
......
...@@ -78,22 +78,31 @@ namespace Siger.ApiACC.Controllers ...@@ -78,22 +78,31 @@ namespace Siger.ApiACC.Controllers
{ {
throw new BadRequestException(RequestEnum.ParameterMiss); throw new BadRequestException(RequestEnum.ParameterMiss);
} }
if(!string.IsNullOrEmpty(req.parentid) && !string.IsNullOrEmpty(req.fixturetoolid) &&
req.parentid == req.fixturetoolid)
{
throw new BadRequestException(RequestEnum.ParentSonSame);
}
var parent = _toolsRepository.Get(q => q.id == req.parentid.ToInt() && q.projectId == ProjectId); var parent = _toolsRepository.Get(q => q.id == req.parentid.ToInt() && q.projectId == ProjectId);
var son = _toolsRepository.Get(q => q.id == req.fixturetoolid.ToInt() && q.projectId == ProjectId); var son = _toolsRepository.Get(q => q.id == req.fixturetoolid.ToInt() && q.projectId == ProjectId);
if (son == null) if (son == null)
{ {
throw new BadRequestException(RequestEnum.FixtureToolNotFound); throw new BadRequestException(RequestEnum.FixtureToolNotFound);
} }
if (parent == null)
{
}
var parentGuid = parent?.guid ?? ""; var parentGuid = parent?.guid ?? "";
var exsit = _toolsAssemblyRepository.Get(q => q.projectId == ProjectId && q.son == son.guid && q.parent == parentGuid); var exsit = _toolsAssemblyRepository.Get(q => q.projectId == ProjectId && q.son == son.guid && q.parent == parentGuid);
if (exsit != null) if (exsit != null)
{ {
throw new BadRequestException(RequestEnum.DataExist); throw new BadRequestException(RequestEnum.DataExist);
} }
if (!string.IsNullOrEmpty(parentGuid))
{
var parentExsit = _toolsAssemblyRepository.Get(q => q.projectId == ProjectId && q.son == parentGuid);
if(parentExsit != null)
{
throw new BadRequestException(RequestEnum.LevelCountError);
}
}
var entity = new siger_automation_fixture_tools_assembly var entity = new siger_automation_fixture_tools_assembly
{ {
...@@ -127,6 +136,11 @@ namespace Siger.ApiACC.Controllers ...@@ -127,6 +136,11 @@ namespace Siger.ApiACC.Controllers
{ {
throw new BadRequestException(RequestEnum.ParameterMiss); throw new BadRequestException(RequestEnum.ParameterMiss);
} }
if (!string.IsNullOrEmpty(req.parentid) && !string.IsNullOrEmpty(req.fixturetoolid) &&
req.parentid == req.fixturetoolid)
{
throw new BadRequestException(RequestEnum.ParentSonSame);
}
var entity = _toolsAssemblyRepository.Get(q => q.projectId == ProjectId && q.id == req.id); var entity = _toolsAssemblyRepository.Get(q => q.projectId == ProjectId && q.id == req.id);
if(entity == null) if(entity == null)
{ {
...@@ -145,6 +159,14 @@ namespace Siger.ApiACC.Controllers ...@@ -145,6 +159,14 @@ namespace Siger.ApiACC.Controllers
{ {
throw new BadRequestException(RequestEnum.DataExist); throw new BadRequestException(RequestEnum.DataExist);
} }
if (!string.IsNullOrEmpty(parentGuid))
{
var parentExsit = _toolsAssemblyRepository.Get(q => q.projectId == ProjectId && q.son == parentGuid);
if (parentExsit != null)
{
throw new BadRequestException(RequestEnum.LevelCountError);
}
}
entity.parent = parent?.guid ?? ""; entity.parent = parent?.guid ?? "";
entity.son = son.guid; entity.son = son.guid;
......
...@@ -1473,5 +1473,8 @@ namespace Siger.Middlelayer.Common ...@@ -1473,5 +1473,8 @@ namespace Siger.Middlelayer.Common
[Description("ID重复")] [Description("ID重复")]
IDExist, IDExist,
[Description("父级和子级不能相同")]
ParentSonSame,
} }
} }
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