diff --git a/src/controllers/PositionController.ts b/src/controllers/PositionController.ts index 9d7ba81b..e9d1499f 100644 --- a/src/controllers/PositionController.ts +++ b/src/controllers/PositionController.ts @@ -3256,37 +3256,15 @@ export class PositionController extends Controller { posId.push(body.posmasterId); let typeCondition: any = {}; if (body.isAll == true) { - if (posMasterMain.orgChild4Id != null) { - typeCondition = { - orgChild4Id: body.posmasterId, - current_holderId: Not(IsNull()), - id: Not(In(posId)), - }; - } else if (posMasterMain.orgChild3Id != null) { - typeCondition = { - orgChild3Id: body.posmasterId, - current_holderId: Not(IsNull()), - id: Not(In(posId)), - }; - } else if (posMasterMain.orgChild2Id != null) { - typeCondition = { - orgChild2Id: body.posmasterId, - current_holderId: Not(IsNull()), - id: Not(In(posId)), - }; - } else if (posMasterMain.orgChild1Id != null) { - typeCondition = { - orgChild1Id: body.posmasterId, - current_holderId: Not(IsNull()), - id: Not(In(posId)), - }; - } else if (posMasterMain.orgRootId != null) { - typeCondition = { - orgRootId: body.posmasterId, - current_holderId: Not(IsNull()), - id: Not(In(posId)), - }; - } + typeCondition = { + orgRootId: posMasterMain.orgRootId, + orgChild1Id: posMasterMain.orgChild1Id, + orgChild2Id: posMasterMain.orgChild2Id, + orgChild3Id: posMasterMain.orgChild3Id, + orgChild4Id: posMasterMain.orgChild4Id, + current_holderId: Not(IsNull()), + id: Not(In(posId)), + }; } else { typeCondition = { orgRootId: posMasterMain.orgRootId == null ? IsNull() : posMasterMain.orgRootId,