Commit 12d1025e by Licx

核算单元编码重复

parent 5e3b9fd4
...@@ -796,7 +796,7 @@ public List<cof_accounting> GetAccountingList(AccoungingRequest request) ...@@ -796,7 +796,7 @@ 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); var existed = cofaccountingRepository.GetEntity(w => w.AllotId == request.AllotId && w.Code == request.Code);
if (existed != null) throw new PerformanceException("核算单元编码重复"); if (existed != null) throw new PerformanceException("核算单元编码重复");
existed = cofaccountingRepository.GetEntity(w => w.AllotId == request.AllotId && w.UnitType == request.UnitType && w.AccountingUnit == request.AccountingUnit); existed = cofaccountingRepository.GetEntity(w => w.AllotId == request.AllotId && w.UnitType == request.UnitType && w.AccountingUnit == request.AccountingUnit);
...@@ -821,6 +821,12 @@ public cof_accounting AccountingInsert(cof_accounting request) ...@@ -821,6 +821,12 @@ public cof_accounting AccountingInsert(cof_accounting request)
/// <returns></returns> /// <returns></returns>
public cof_accounting AccountingUpdate(cof_accounting request) public cof_accounting AccountingUpdate(cof_accounting request)
{ {
var existed = cofaccountingRepository.GetEntity(w => w.AllotId == request.AllotId && w.Code == request.Code);
if (existed != null) throw new PerformanceException("核算单元编码重复");
existed = cofaccountingRepository.GetEntity(w => w.AllotId == request.AllotId && w.UnitType == request.UnitType && w.AccountingUnit == request.AccountingUnit);
if (existed != null) throw new PerformanceException("核算单元、核算组别已存在");
var entity = cofaccountingRepository.GetEntity(t => t.Id == request.Id); var entity = cofaccountingRepository.GetEntity(t => t.Id == request.Id);
if (null == entity) if (null == entity)
throw new PerformanceException($"ID不存在 :{request.Id}"); throw new PerformanceException($"ID不存在 :{request.Id}");
......
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