Commit 6d7089ad by lcx

添加核算单元及组别时,进行重复校验

parent 033dbf29
...@@ -626,8 +626,8 @@ public ApiResponse GetAccountingList([FromBody] AccoungingRequest request) ...@@ -626,8 +626,8 @@ public ApiResponse GetAccountingList([FromBody] AccoungingRequest request)
[HttpPost] [HttpPost]
public ApiResponse AccountingInsert([FromBody] cof_accounting request) public ApiResponse AccountingInsert([FromBody] cof_accounting request)
{ {
if (request.AllotId == 0 || string.IsNullOrEmpty(request.UnitType) || string.IsNullOrEmpty(request.AccountingUnit)) if (request.AllotId == 0 || string.IsNullOrEmpty(request.Code) || string.IsNullOrEmpty(request.UnitType) || string.IsNullOrEmpty(request.AccountingUnit))
return new ApiResponse(ResponseType.ParameterError); return new ApiResponse(ResponseType.ParameterError, "参数不允许为空");
var drugprop = _configService.AccountingInsert(request); var drugprop = _configService.AccountingInsert(request);
return new ApiResponse(ResponseType.OK, drugprop); return new ApiResponse(ResponseType.OK, drugprop);
...@@ -678,7 +678,7 @@ public ApiResponse BatchAccountingStructrue([FromRoute] int allotId) ...@@ -678,7 +678,7 @@ public ApiResponse BatchAccountingStructrue([FromRoute] int allotId)
} }
/// <summary> /// <summary>
/// 核算单元及组别批量添加 /// 核算单元及组别检验
/// </summary> /// </summary>
/// <param name="allotId"></param> /// <param name="allotId"></param>
/// <returns></returns> /// <returns></returns>
......
...@@ -796,6 +796,12 @@ public List<cof_accounting> GetAccountingList(AccoungingRequest request) ...@@ -796,6 +796,12 @@ public List<cof_accounting> GetAccountingList(AccoungingRequest request)
/// <returns></returns> /// <returns></returns>
public cof_accounting AccountingInsert(cof_accounting request) public cof_accounting AccountingInsert(cof_accounting request)
{ {
var existed = cofaccountingRepository.GetEntity(w => w.Code == request.Code);
if (existed != null) throw new PerformanceException("核算单元编码重复");
existed = cofaccountingRepository.GetEntity(w => w.UnitType == request.UnitType && w.AccountingUnit == request.AccountingUnit);
if (existed != null) throw new PerformanceException("核算单元、核算组别已存在");
var entity = new cof_accounting var entity = new cof_accounting
{ {
AllotId = request.AllotId, AllotId = request.AllotId,
......
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