Commit da5ec7cb by xin.yang

some update

parent 7d83939f
......@@ -136,6 +136,7 @@ namespace Siger.ApiACC.Controllers
updatetime = DateTime.Now,
updator = UserId,
status = req.status.ToInt() == (int)RowState.Valid ? (int)RowState.Valid : (int)RowState.Invalid,
remark = req.remark
};
_toolsAssemblyRepository.Insert(parentEntity);
}
......@@ -219,6 +220,7 @@ namespace Siger.ApiACC.Controllers
projectId = ProjectId,
updatetime = DateTime.Now,
updator = UserId,
remark = req.remark,
status = req.status.ToInt() == (int)RowState.Valid ? (int)RowState.Valid : (int)RowState.Invalid,
};
_toolsAssemblyRepository.Insert(parentEntity);
......@@ -231,6 +233,7 @@ namespace Siger.ApiACC.Controllers
entity.updatetime = DateTime.Now;
entity.updator = UserId;
entity.status = req.status.ToInt() == (int)RowState.Valid ? (int)RowState.Valid : (int)RowState.Invalid;
entity.remark = req.remark;
_toolsAssemblyRepository.Update(entity);
if (_unitOfWork.Commit() > 0)
{
......
......@@ -27,13 +27,15 @@ namespace Siger.ApiACC.Controllers
private readonly IUnitOfWork _unitOfWork;
private readonly IAutomationFixtureToolsCategoryRepository _toolsCategoryRepository;
private readonly IAutomationFixtureToolsRepository _toolsRepository;
private readonly IAutomationLocationRepository _automationLocationRepository;
public FixtureToolsController(IUnitOfWork unitOfWork, IAutomationFixtureToolsCategoryRepository toolsCategoryRepository,
IAutomationFixtureToolsRepository toolsRepository)
IAutomationFixtureToolsRepository toolsRepository, IAutomationLocationRepository automationLocationRepository)
{
_unitOfWork = unitOfWork;
_toolsCategoryRepository = toolsCategoryRepository;
_toolsRepository = toolsRepository;
_automationLocationRepository = automationLocationRepository;
}
public IActionResult GetPageList(string category, string code, string name, string state, int page, int pagesize, string toexcel)
......@@ -387,12 +389,22 @@ namespace Siger.ApiACC.Controllers
[HttpGet]
public IActionResult DeleteCategory(int id)
{
var entity = _toolsCategoryRepository.Get(q => q.projectId == ProjectId && q.status == (int)RowState.Valid && q.id == id);
var categorys = _toolsCategoryRepository.GetList(q => q.projectId == ProjectId && q.status == (int)RowState.Valid).ToList();
var entity = categorys.FirstOrDefault(q => q.id == id);
if (entity == null)
{
throw new BadRequestException(CommonEnum.RecordNotFound);
}
var details = GetSonCategoryList(entity.guid, categorys);
var detailIds = details.Select(q => q.id).Distinct().ToList();
var delDetails = _toolsCategoryRepository.GetList(q => q.projectId == ProjectId && q.status == (int)RowState.Valid &&
detailIds.Contains(q.id)).ToList();
foreach (var detail in delDetails)
{
detail.status = (int)RowState.Invalid;
_toolsCategoryRepository.Update(detail);
}
entity.status = (int)RowState.Invalid;
_toolsCategoryRepository.Update(entity);
if(_unitOfWork.Commit() > 0)
......@@ -405,28 +417,11 @@ namespace Siger.ApiACC.Controllers
}
}
[HttpPost]
public IActionResult DeleteCategorys([FromBody]RequestDeleteRange req)
{
if (req.ids == null || !req.ids.Any())
{
throw new BadRequestException(RequestEnum.ParameterMiss);
}
var entities = _toolsCategoryRepository.GetList(t =>
req.ids.Contains(t.id) && t.projectId == ProjectId && t.status == (int)RowState.Valid).ToList();
if (!entities.Any())
private IEnumerable<siger_automation_fixture_tools_category> GetSonCategoryList(string parentId, List<siger_automation_fixture_tools_category> sections)
{
throw new BadRequestException(CommonEnum.RecordNotFound);
}
foreach (var entity in entities)
{
entity.status = (int)RowState.Invalid;
_toolsCategoryRepository.Update(entity);
}
var query = from c in sections where c.parent == parentId select c;
if (_unitOfWork.Commit() > 0)
return new ObjectResult(CommonEnum.Succefull);
throw new BadRequestException(CommonEnum.Fail);
return query.ToList().Concat(query.ToList().SelectMany(t => GetSonCategoryList(t.parent, sections)));
}
[HttpGet]
......
......@@ -287,6 +287,19 @@ namespace Siger.ApiConfig.Controller
case TemplateNameEnums.TechMouldList:
type = typeof(TechMouldList);
break;
//自动化加工
case TemplateNameEnums.FixtureToolsCategoryTemplate:
type = typeof(FixtureToolsCategoryTemplate);
break;
case TemplateNameEnums.FixtureToolsTemplate:
type = typeof(FixtureToolsTemplate);
break;
case TemplateNameEnums.FixtureToolsProductTemplate:
type = typeof(FixtureToolsProductTemplate);
break;
case TemplateNameEnums.FixtureToolsAssmeblyTemplate:
type = typeof(FixtureToolsAssmeblyTemplate);
break;
}
return type;
......
......@@ -231,7 +231,11 @@ namespace Siger.Middlelayer.Common
MouldDetection,//模具测试项导入
MouldCoreDetection,//模芯测试项导入
TechMouldList, //模具清单
//自动化加工
FixtureToolsCategoryTemplate,
FixtureToolsTemplate,
FixtureToolsProductTemplate,
FixtureToolsAssmeblyTemplate,
}
public enum LogLevel
......
......@@ -39,6 +39,12 @@ namespace Siger.Middlelayer.Utility.ImportEntities
[ExcelColumn("备注")]
public string Remark { get; set; }
[ExcelColumn("维护人")]
public string Updator { get; set; }
[ExcelColumn("维护时间")]
public string UpdateTime { get; set; }
}
public class FixtureToolsProductTemplate : ImportBase
......
......@@ -26,6 +26,8 @@ namespace Siger.Middlelayer.AccRepository.Entities
/// 附件名称
/// </summary>
public string filename { get; set; }
public string remark { get; set; }
public int creator { get; set; }
public DateTime createtime { get; set; }
public int updator { get; set; }
......
......@@ -53,7 +53,8 @@ namespace Siger.Middlelayer.AccRepository.Repositories
cate_guid = t2.guid,
parentcate_guid = t1.guid,
parentguid = q.parent,
fixtureguid = q.son
fixtureguid = q.son,
remark = q.remark
};
Expression<Func<ResponseAumationFixtureToolsAssembly, bool>> categoryExpression = f => true;
if (category > 0)
......@@ -107,7 +108,8 @@ namespace Siger.Middlelayer.AccRepository.Repositories
cate_guid = t2.guid,
parentcate_guid = t1.guid,
parentguid = q.parent,
fixtureguid = q.son
fixtureguid = q.son,
remark = q.remark
};
var entities = query.OrderByDescending(q => q.id).AsNoTracking().ToList();
return entities;
......
......@@ -108,7 +108,8 @@ namespace Siger.Middlelayer.AccRepository.Repositories
fixturetoolid = t.id,
code = t.code,
name = t.name,
materialsn = m.sn ?? ""
materialsn = m.sn ?? "",
categoryid = c == null ? 0 : c.id
};
var entities = query.AsNoTracking().ToList();
return entities;
......
......@@ -132,6 +132,8 @@ namespace Siger.Middlelayer.AccRepository.Request
public string filename { get; set; }
public string status { get; set; }
public string remark { get; set; }
}
public class RequestUpdateFixtureToolAssembly : RequestAddFixtureToolAssembly
......
......@@ -145,5 +145,7 @@ namespace Siger.Middlelayer.AccRepository.Response
public string fixtureguid { get; set; }
public List<ResponseAumationFixtureToolsAssembly> children { get; set; }
public string remark { get; set; }
}
}
......@@ -80,5 +80,7 @@ namespace Siger.Middlelayer.AccRepository.Response
public string code { get; set; }
public string name { get; set; }
public string materialsn { get; set; }
public int categoryid { get; set; }
}
}
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