เช็คตำแหน่งซ้ำ

This commit is contained in:
Kittapath 2024-02-20 13:35:11 +07:00
parent 885e1e725c
commit 5df57fc4d6
3 changed files with 408 additions and 9 deletions

View file

@ -140,9 +140,10 @@ export class ReportController extends Controller {
for (let orgRoot of orgRootData) {
await Promise.all(
orgRoot.posMasters
.filter((x) => x.orgChild1Id == null)
.sort((a, b) => a.posMasterOrder - b.posMasterOrder)
.map(async (posMaster) => {
if (posMaster.orgChild1 == null) {
if (posMaster.orgChild1Id == null) {
const positionName = [...new Set(posMaster.positions.map((x) => x.positionName))];
const posType = [
...new Set(
@ -237,6 +238,7 @@ export class ReportController extends Controller {
)) {
await Promise.all(
orgChild1.posMasters
.filter((x) => x.orgChild2Id == null)
.sort((a, b) => a.posMasterOrder - b.posMasterOrder)
.map(async (posMaster) => {
if (posMaster.orgChild2Id == null) {
@ -336,9 +338,10 @@ export class ReportController extends Controller {
)) {
await Promise.all(
orgChild2.posMasters
.filter((x) => x.orgChild3Id == null)
.sort((a, b) => a.posMasterOrder - b.posMasterOrder)
.map(async (posMaster) => {
if (posMaster.orgChild3 == null) {
if (posMaster.orgChild3Id == null) {
const positionName = [
...new Set(posMaster.positions.map((x) => x.positionName)),
];
@ -438,9 +441,10 @@ export class ReportController extends Controller {
)) {
await Promise.all(
orgChild3.posMasters
.filter((x) => x.orgChild4Id == null)
.sort((a, b) => a.posMasterOrder - b.posMasterOrder)
.map(async (posMaster) => {
if (posMaster.orgChild3 == null) {
if (posMaster.orgChild4Id == null) {
const positionName = [
...new Set(posMaster.positions.map((x) => x.positionName)),
];
@ -846,7 +850,7 @@ export class ReportController extends Controller {
orgRoot.posMasters
.sort((a, b) => a.posMasterOrder - b.posMasterOrder)
.map(async (posMaster) => {
if (posMaster.orgChild1 == null) {
if (posMaster.orgChild1Id == null) {
const positionName = [...new Set(posMaster.positions.map((x) => x.positionName))];
const posType = [
...new Set(
@ -1427,7 +1431,7 @@ export class ReportController extends Controller {
orgChild2.posMasters
.sort((a, b) => a.posMasterOrder - b.posMasterOrder)
.map(async (posMaster) => {
if (posMaster.orgChild3 == null) {
if (posMaster.orgChild3Id == null) {
const positionName = [
...new Set(posMaster.positions.map((x) => x.positionName)),
];
@ -1721,7 +1725,7 @@ export class ReportController extends Controller {
orgChild3.posMasters
.sort((a, b) => a.posMasterOrder - b.posMasterOrder)
.map(async (posMaster) => {
if (posMaster.orgChild3 == null) {
if (posMaster.orgChild4Id == null) {
const positionName = [
...new Set(posMaster.positions.map((x) => x.positionName)),
];
@ -2515,7 +2519,7 @@ export class ReportController extends Controller {
orgRoot.posMasters
.sort((a, b) => a.posMasterOrder - b.posMasterOrder)
.map(async (posMaster) => {
if (posMaster.orgChild1 == null && posMaster.next_holder != null) {
if (posMaster.orgChild1Id == null && posMaster.next_holder != null) {
let positionMasterProfileOld: any = null;
if (posMaster.next_holder != null) {
positionMasterProfileOld = posMaster.next_holder.current_holders.find(
@ -2780,7 +2784,7 @@ export class ReportController extends Controller {
orgChild2.posMasters
.sort((a, b) => a.posMasterOrder - b.posMasterOrder)
.map(async (posMaster) => {
if (posMaster.orgChild3 == null && posMaster.next_holder != null) {
if (posMaster.orgChild3Id == null && posMaster.next_holder != null) {
let positionMasterProfileOld: any = null;
if (posMaster.next_holder != null) {
positionMasterProfileOld = posMaster.next_holder.current_holders.find(
@ -2913,7 +2917,7 @@ export class ReportController extends Controller {
orgChild3.posMasters
.sort((a, b) => a.posMasterOrder - b.posMasterOrder)
.map(async (posMaster) => {
if (posMaster.orgChild3 == null && posMaster.next_holder != null) {
if (posMaster.orgChild4Id == null && posMaster.next_holder != null) {
let positionMasterProfileOld: any = null;
if (posMaster.next_holder != null) {
positionMasterProfileOld = posMaster.next_holder.current_holders.find(