This commit is contained in:
AdisakKanthawilang 2025-06-23 16:48:05 +07:00
parent 27653c18b3
commit fc9e1fe6e3
2 changed files with 23 additions and 1 deletions

View file

@ -3512,9 +3512,12 @@ export class PositionController extends Controller {
}
await this.positionRepository.save(position);
});
const _null: any = null;
const before = null;
dataMaster.isSit = requestBody.isSit;
dataMaster.next_holderId = requestBody.profileId;
//add on
dataMaster.conditionReason = _null;
await this.posMasterRepository.save(dataMaster, { data: request });
setLogDataDiff(request, { before, after: dataMaster });

View file

@ -434,13 +434,13 @@ async function handler_org(msg: amqp.ConsumeMessage): Promise<boolean> {
"positions.posExecutive",
],
});
const _null: any = null;
for (const item of posMaster) {
if (item.next_holderId != null) {
const profile = await repoProfile.findOne({
where: { id: item.next_holderId == null ? "" : item.next_holderId },
});
const position = await item.positions.find((x) => x.positionIsSelected == true);
const _null: any = null;
if (profile != null) {
profile.posLevelId = position?.posLevelId ?? _null;
profile.posTypeId = position?.posTypeId ?? _null;
@ -449,6 +449,9 @@ async function handler_org(msg: amqp.ConsumeMessage): Promise<boolean> {
}
}
item.current_holderId = item.next_holderId;
if(item.current_holderId){
item.conditionReason = _null;
}
item.next_holderId = null;
item.lastUpdateUserId = lastUpdateUserId;
item.lastUpdateFullName = lastUpdateFullName;
@ -1518,6 +1521,7 @@ async function handler_org_draft(msg: amqp.ConsumeMessage): Promise<boolean> {
// Create org
for await (const x0 of _orgRoot) {
var dataId = x0.id;
var _null: any = null;
// console.log(`ch0 ${x0.orgRootOrder}`);
// console.log(dataId);
delete x0.id;
@ -1556,6 +1560,9 @@ async function handler_org_draft(msg: amqp.ConsumeMessage): Promise<boolean> {
)
) {
posMaster.next_holderId = item.current_holderId;
if(posMaster.next_holderId){
posMaster.conditionReason = _null;
}
} else {
posMaster.next_holderId = null;
posMaster.isSit = false;
@ -1648,6 +1655,9 @@ async function handler_org_draft(msg: amqp.ConsumeMessage): Promise<boolean> {
)
) {
posMaster.next_holderId = item.current_holderId;
if(posMaster.next_holderId){
posMaster.conditionReason = _null;
}
} else {
posMaster.next_holderId = null;
posMaster.isSit = false;
@ -1742,6 +1752,9 @@ async function handler_org_draft(msg: amqp.ConsumeMessage): Promise<boolean> {
)
) {
posMaster.next_holderId = item.current_holderId;
if(posMaster.next_holderId){
posMaster.conditionReason = _null;
}
} else {
posMaster.next_holderId = null;
posMaster.isSit = false;
@ -1838,6 +1851,9 @@ async function handler_org_draft(msg: amqp.ConsumeMessage): Promise<boolean> {
)
) {
posMaster.next_holderId = item.current_holderId;
if(posMaster.next_holderId){
posMaster.conditionReason = _null;
}
} else {
posMaster.next_holderId = null;
posMaster.isSit = false;
@ -1937,6 +1953,9 @@ async function handler_org_draft(msg: amqp.ConsumeMessage): Promise<boolean> {
)
) {
posMaster.next_holderId = item.current_holderId;
if(posMaster.next_holderId){
posMaster.conditionReason = _null;
}
} else {
posMaster.next_holderId = null;
posMaster.isSit = false;