Commit c30773e8 by xin.yang

some update

parent 0932ae55
...@@ -720,6 +720,7 @@ export default { ...@@ -720,6 +720,7 @@ export default {
'9000495': '未找到工装信息', '9000495': '未找到工装信息',
'9000496': 'ID重复', '9000496': 'ID重复',
'9000497': '父级和子级不能相同', '9000497': '父级和子级不能相同',
'9000498': '该类型绑定了工装,不能删除',
'9100000': 'Departments cannot be empty', '9100000': 'Departments cannot be empty',
'9100001': 'Position cannot be empty', '9100001': 'Position cannot be empty',
......
...@@ -747,6 +747,7 @@ export default { ...@@ -747,6 +747,7 @@ export default {
'9000495': '未找到工装信息', '9000495': '未找到工装信息',
'9000496': 'ID重复', '9000496': 'ID重复',
'9000497': '父级和子级不能相同', '9000497': '父级和子级不能相同',
'9000498': '该类型绑定了工装,不能删除',
'9100000': '部门不能为空', '9100000': '部门不能为空',
......
...@@ -401,18 +401,23 @@ namespace Siger.ApiACC.Controllers ...@@ -401,18 +401,23 @@ namespace Siger.ApiACC.Controllers
{ {
throw new BadRequestException(CommonEnum.RecordNotFound); throw new BadRequestException(CommonEnum.RecordNotFound);
} }
var details = GetSonCategoryList(entity.guid, categorys); var details = GetSonCategoryList(entity.guid, categorys).ToList();
var detailIds = details.Select(q => q.id).Distinct().ToList(); details.Add(entity);
var detailGuids = details.Select(q => q.guid).Distinct().ToList();
if (_toolsRepository.GetList(q => q.projectId == ProjectId && detailGuids.Contains(q.category)).Any())
{
throw new BadRequestException(RequestEnum.CategoryBindFixtureToolData);
}
var delDetails = _toolsCategoryRepository.GetList(q => q.projectId == ProjectId && q.status == (int)RowState.Valid && var delDetails = _toolsCategoryRepository.GetList(q => q.projectId == ProjectId && q.status == (int)RowState.Valid &&
detailIds.Contains(q.id)).ToList(); detailGuids.Contains(q.guid)).ToList();
foreach (var detail in delDetails) foreach (var detail in delDetails)
{ {
detail.status = (int)RowState.Invalid; detail.status = (int)RowState.Invalid;
_toolsCategoryRepository.Update(detail); _toolsCategoryRepository.Update(detail);
} }
entity.status = (int)RowState.Invalid;
_toolsCategoryRepository.Update(entity);
if(_unitOfWork.Commit() > 0) if(_unitOfWork.Commit() > 0)
{ {
return new ObjectResult(CommonEnum.Succefull); return new ObjectResult(CommonEnum.Succefull);
......
...@@ -1476,5 +1476,8 @@ namespace Siger.Middlelayer.Common ...@@ -1476,5 +1476,8 @@ namespace Siger.Middlelayer.Common
[Description("父级和子级不能相同")] [Description("父级和子级不能相同")]
ParentSonSame, ParentSonSame,
[Description("该类型绑定了工装,不能删除")]
CategoryBindFixtureToolData,
} }
} }
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