no message

This commit is contained in:
Kittapath 2024-06-26 00:06:51 +07:00
parent d0cf79d08f
commit 7156eed4f9

View file

@ -3202,6 +3202,7 @@ export class PositionController extends Controller {
@Body()
body: {
posmasterId: string;
isAll: boolean;
},
) {
const posMasterMain = await this.posMasterRepository.findOne({
@ -3213,15 +3214,50 @@ export class PositionController extends Controller {
}
let posId: any = posMasterMain.posMasterActs.map((x) => x.posMasterChildId);
posId.push(body.posmasterId);
let typeCondition: any = {
orgRootId: posMasterMain.orgRootId == null ? IsNull() : posMasterMain.orgRootId,
orgChild1Id: posMasterMain.orgChild1Id == null ? IsNull() : posMasterMain.orgChild1Id,
orgChild2Id: posMasterMain.orgChild2Id == null ? IsNull() : posMasterMain.orgChild2Id,
orgChild3Id: posMasterMain.orgChild3Id == null ? IsNull() : posMasterMain.orgChild3Id,
orgChild4Id: posMasterMain.orgChild4Id == null ? IsNull() : posMasterMain.orgChild4Id,
current_holderId: Not(IsNull()),
id: Not(In(posId)),
};
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)),
};
}
} else {
typeCondition = {
orgRootId: posMasterMain.orgRootId == null ? IsNull() : posMasterMain.orgRootId,
orgChild1Id: posMasterMain.orgChild1Id == null ? IsNull() : posMasterMain.orgChild1Id,
orgChild2Id: posMasterMain.orgChild2Id == null ? IsNull() : posMasterMain.orgChild2Id,
orgChild3Id: posMasterMain.orgChild3Id == null ? IsNull() : posMasterMain.orgChild3Id,
orgChild4Id: posMasterMain.orgChild4Id == null ? IsNull() : posMasterMain.orgChild4Id,
current_holderId: Not(IsNull()),
id: Not(In(posId)),
};
}
const posMaster = await this.posMasterRepository.find({
where: typeCondition,
relations: [