import { Entity, Column, ManyToOne, JoinColumn, OneToMany, Double } from "typeorm"; import { EntityBase } from "./base/Base"; import { Province } from "./Province"; import { ActualPeople, CreateActualPeople } from "./ActualPeople"; import { CreatePlannedPeople, PlannedPeople } from "./PlannedPeople"; import { ActualGoal, CreateActualGoal } from "./ActualGoal"; import { CreatePlannedGoal, PlannedGoal } from "./PlannedGoal"; import { DevelopmentHistory } from "./DevelopmentHistory"; import { DevelopmentProjectType } from "./DevelopmentProjectType"; import { DevelopmentProjectTechniquePlanned } from "./DevelopmentProjectTechniquePlanned"; import { DevelopmentEvaluation } from "./DevelopmentEvaluation"; import { CreateDevelopmentAddress, DevelopmentAddress } from "./DevelopmentAddress"; import { DevelopmentProjectTechniqueActual } from "./DevelopmentProjectTechniqueActual"; import { StrategyChild5 } from "./StrategyChild5"; import { StrategyChild4 } from "./StrategyChild4"; import { StrategyChild3 } from "./StrategyChild3"; import { StrategyChild2 } from "./StrategyChild2"; import { StrategyChild1 } from "./StrategyChild1"; import { DevelopmentRisk } from "./DevelopmentRisk"; import { DevelopmentOther } from "./DevelopmentOther"; @Entity("development") export class Development extends EntityBase { @Column({ nullable: true, comment: "id หน่วยงาน", default: null, }) rootId: string; @Column({ nullable: true, comment: "ชื่อหน่วยงาน", default: null, }) root: string; @Column({ nullable: true, comment: "ชื่อย่อหน่วยงาน", default: null, }) rootShortName: string; @Column({ nullable: true, comment: "id หน่วยงาน child1", default: null, }) child1Id: string; @Column({ nullable: true, comment: "ชื่อหน่วยงาน child1", default: null, }) child1: string; @Column({ nullable: true, comment: "ชื่อย่อหน่วยงาน child1", default: null, }) child1ShortName: string; @Column({ nullable: true, comment: "id หน่วยงาน child2", default: null, }) child2Id: string; @Column({ nullable: true, comment: "ชื่อหน่วยงาน child2", default: null, }) child2: string; @Column({ nullable: true, comment: "ชื่อย่อหน่วยงาน child2", default: null, }) child2ShortName: string; @Column({ nullable: true, comment: "id หน่วยงาน child3", default: null, }) child3Id: string; @Column({ nullable: true, comment: "ชื่อหน่วยงาน child3", default: null, }) child3: string; @Column({ nullable: true, comment: "ชื่อย่อหน่วยงาน child3", default: null, }) child3ShortName: string; @Column({ nullable: true, comment: "id หน่วยงาน child4", default: null, }) child4Id: string; @Column({ nullable: true, comment: "ชื่อหน่วยงาน child4", default: null, }) child4: string; @Column({ nullable: true, comment: "ชื่อย่อหน่วยงาน child4", default: null, }) child4ShortName: string; @Column({ nullable: true, comment: "id revision", default: null, }) orgRevisionId: string; @Column({ // กำลังดำเนินการ (ONGOING) // เสร็จสิ้น (FINISH) nullable: true, comment: "สถานะ", default: "ONGOING", }) status: string; ////////////////////////////////////////tab ข้อมูลเบื้องต้น @Column({ nullable: true, comment: "ปีงบประมาณ", }) year: number; @Column({ comment: "ชื่อโครงการ/กิจกรรม/หลักสูตร", length: 255, }) projectName: string; @Column({ nullable: true, comment: "หลักการและเหตุผล", default: null, type: "text", }) reason: string; @Column({ nullable: true, comment: "วัตถุประสงค์", default: null, type: "text", }) objective: string; ////////////////////////////////////////tab เป้าหมาย @OneToMany( () => ActualPeople, (actualPeople: ActualPeople) => actualPeople.developmentActualPeople, ) developmentActualPeoples: ActualPeople[]; @OneToMany(() => ActualGoal, (actualGoal: ActualGoal) => actualGoal.developmentActualGoal) developmentActualGoals: ActualGoal[]; @OneToMany( () => PlannedPeople, (plannedPeople: PlannedPeople) => plannedPeople.developmentPlannedPeople, ) developmentPlannedPeoples: PlannedPeople[]; @OneToMany(() => PlannedGoal, (plannedGoal: PlannedGoal) => plannedGoal.developmentPlannedGoal) developmentPlannedGoals: PlannedGoal[]; @OneToMany( () => DevelopmentRisk, (developmentRisk: DevelopmentRisk) => developmentRisk.development, ) developmentRisks: DevelopmentRisk[]; @OneToMany( () => DevelopmentOther, (developmentOther: DevelopmentOther) => developmentOther.development, ) developmentOthers: DevelopmentOther[]; @OneToMany( () => DevelopmentProjectType, (developmentProjectType: DevelopmentProjectType) => developmentProjectType.development, ) developmentProjectTypes: DevelopmentProjectType[]; @Column({ comment: "ไป-กลับ", default: false, }) isBackPlanned: boolean; @Column({ comment: "พักค้าง", default: false, }) isHoldPlanned: boolean; @Column({ nullable: true, comment: "จำนวน(วัน)(ไป-กลับ)", default: null, }) projectDayBackPlanned: number; @Column({ nullable: true, comment: "จำนวน(วัน)(พักค้าง)", default: null, }) projectDayHoldPlanned: number; @Column({ nullable: true, comment: "จำนวน(คืน)(พักค้าง)", default: null, }) projectNigthHoldPlanned: number; @Column({ comment: "ไป-กลับ", default: false, }) isBackActual: boolean; @Column({ comment: "พักค้าง", default: false, }) isHoldActual: boolean; @Column({ nullable: true, comment: "จำนวน(วัน)(ไป-กลับ)", default: null, }) projectDayBackActual: number; @Column({ nullable: true, comment: "จำนวน(วัน)(พักค้าง)", default: null, }) projectDayHoldActual: number; @Column({ nullable: true, comment: "จำนวน(คืน)(พักค้าง)", default: null, }) projectNigthHoldActual: number; @Column({ nullable: true, comment: "รายละเอียดอื่นๆ 70 แผน", default: null, }) reasonPlanned70: string; @Column({ nullable: true, comment: "รายละเอียดอื่นๆ 20 แผน", default: null, }) reasonPlanned20: string; @Column({ nullable: true, comment: "รายละเอียดอื่นๆ 10 แผน", default: null, }) reasonPlanned10: string; @Column({ comment: "รายละเอียดอื่นๆ 70 แผน", default: false, }) isReasonPlanned70: boolean; @Column({ comment: "รายละเอียดอื่นๆ 20 แผน", default: false, }) isReasonPlanned20: boolean; @Column({ nullable: true, comment: "รายละเอียดอื่นๆ 10 แผน", default: null, }) isReasonPlanned10: string; @OneToMany( () => DevelopmentProjectTechniquePlanned, (developmentProjectTechniquePlanned: DevelopmentProjectTechniquePlanned) => developmentProjectTechniquePlanned.development, ) developmentProjectTechniquePlanneds: DevelopmentProjectTechniquePlanned[]; @Column({ nullable: true, comment: "รายละเอียดอื่นๆ 70 จริง", default: null, }) reasonActual70: string; @Column({ nullable: true, comment: "รายละเอียดอื่นๆ 20 จริง", default: null, }) reasonActual20: string; @Column({ nullable: true, comment: "รายละเอียดอื่นๆ 10 จริง", default: null, }) reasonActual10: string; @Column({ comment: "รายละเอียดอื่นๆ 70 จริง", default: false, }) isReasonActual70: boolean; @Column({ comment: "รายละเอียดอื่นๆ 20 จริง", default: false, }) isReasonActual20: boolean; @Column({ nullable: true, comment: "รายละเอียดอื่นๆ 10 จริง", default: null, }) isReasonActual10: string; @OneToMany( () => DevelopmentProjectTechniqueActual, (developmentProjectTechniqueActual: DevelopmentProjectTechniqueActual) => developmentProjectTechniqueActual.development, ) developmentProjectTechniqueActuals: DevelopmentProjectTechniqueActual[]; @Column({ nullable: true, comment: "จำนวน(รุ่น)ตามแผน", default: null, }) projectModalPlanned: number; @Column({ nullable: true, comment: "จำนวน(รุ่น)ตามจริง", default: null, }) projectModalActual: number; ////////////////////////////////////////tab ผลประเมิน @OneToMany( () => DevelopmentEvaluation, (developmentEvaluation: DevelopmentEvaluation) => developmentEvaluation.development, ) developmentEvaluations: DevelopmentEvaluation[]; @Column({ nullable: true, comment: "ประเภทโครงการ", default: null, }) project: string; @Column({ comment: "ผ่านการพิจาณา ได้รับการจัดสรรงบประมาณตามข้อบัญญัติ", default: false, }) isPassAllocate: boolean; @Column({ comment: "ผ่านการพิจารณา ไม่ได้รับการจัดสรรงบประมาณตามข้อบัญญัติ แต่ได้รับการจัดสรรเงินนอกงบประมาณ", default: false, }) isPassNoAllocate: boolean; @Column({ comment: "ไม่ผ่านการพิจารณา แต่ได้รับการจัดสรรเงินนอกงบประมาณ", default: false, }) isNoPass: boolean; @Column({ comment: "แต่ได้รับการจัดสรรงบประมาณตามข้อบัญญัติ", default: false, }) isBudget: boolean; @Column({ comment: "แต่ได้รับการจัดสรรเงินนอกงบประมาณ", default: false, }) isOutBudget: boolean; ////////////////////////////////////////tab อื่นๆ @Column({ nullable: true, type: "datetime", comment: "วันที่เริ่มต้น", default: null, }) dateStart: Date; @Column({ nullable: true, type: "datetime", comment: "วันที่สิ้นสุด", default: null, }) dateEnd: Date; @Column({ nullable: true, comment: "รวมระยะเวลา (วัน)", default: null, }) totalDate: number; @OneToMany( () => DevelopmentAddress, (developmentAddress: DevelopmentAddress) => developmentAddress.development, ) developmentAddresss: DevelopmentAddress[]; @Column({ nullable: true, comment: "ประเภทงบประมาณ", default: null, }) budget: string; @Column({ // เงินบำรุง = MAINTENANCE // เงินกองทุน = FUND // เงินอุดหนุน = SUBSIDY nullable: true, comment: "ประเภทย่อย", default: null, }) budgetSub: string; @Column({ nullable: true, comment: "จํานวนงบประมาณที่ขอรับการจัดสรรฯ", default: 0, type: "double", }) accept: Double; @Column({ nullable: true, comment: "จํานวนงบประมาณที่ได้รับการจัดสรรฯ", default: 0, type: "double", }) receive: Double; @Column({ nullable: true, comment: "จํานวนงบประมาณที่ได้รับอนุมัติ", default: 0, type: "double", }) approved: Double; @Column({ nullable: true, comment: "จํานวนงบประมาณที่จ่ายจริง", default: 0, type: "double", }) budgetPay: Double; @Column({ nullable: true, comment: "ประเด็นความเสี่ยง", default: null, }) issues: string; @Column({ nullable: true, comment: "โอกาสที่จะเกิด", default: null, }) chance: number; @Column({ nullable: true, comment: "ผลกระทบจากการเกิด", default: null, }) effects: number; @Column({ nullable: true, comment: "ระดับความเสี่ยง", default: null, }) riskLevel: string; @Column({ nullable: true, comment: "เเนวทางการบริหารความเสี่ยง", default: null, }) riskManagement: string; @Column({ nullable: true, comment: "ประโยชน์ที่คาดว่าจะได้รับ", default: null, }) expect: string; @Column({ nullable: true, comment: "หัวข้อ/ประเด็นการฝึกอบรม ศึกษาดูงาน", default: null, }) topicAcademic: string; @Column({ nullable: true, comment: "สถานที่ฝึกอบรม ศึกษาดูงาน", default: null, }) addressAcademic: string; @Column({ nullable: true, comment: "จังหวัด(ข้อมูลวิชาการ)", default: null, }) provinceActualId: string; @ManyToOne(() => Province, (province: Province) => province.developmentActuals) @JoinColumn({ name: "provinceActualId" }) provinceActual: Province; @Column({ nullable: true, type: "datetime", comment: "วันเริ่มต้นการศึกษาดูงาน", default: null, }) dateStudyStart: Date; @Column({ nullable: true, type: "datetime", comment: "วันสิ้นสุดการศึกษาดูงาน", default: null, }) dateStudyEnd: Date; @OneToMany( () => DevelopmentHistory, (developmentHistory: DevelopmentHistory) => developmentHistory.development, ) developmentHistorys: DevelopmentHistory[]; @Column({ nullable: true, length: 40, comment: "คีย์นอก(FK)ของตาราง strategyChild1 เป้าหมายตามแผน", default: null, }) strategyChild1PlannedId: string; @ManyToOne(() => StrategyChild1, (strategyChild1) => strategyChild1.developmentPlanneds) @JoinColumn({ name: "strategyChild1PlannedId" }) strategyChild1Planned: StrategyChild1; @Column({ nullable: true, length: 40, comment: "คีย์นอก(FK)ของตาราง strategyChild2 เป้าหมายตามแผน", default: null, }) strategyChild2PlannedId: string; @ManyToOne(() => StrategyChild2, (strategyChild2) => strategyChild2.developmentPlanneds) @JoinColumn({ name: "strategyChild2PlannedId" }) strategyChild2Planned: StrategyChild2; @Column({ nullable: true, length: 40, comment: "คีย์นอก(FK)ของตาราง strategyChild3 เป้าหมายตามแผน", default: null, }) strategyChild3PlannedId: string; @ManyToOne(() => StrategyChild3, (strategyChild3) => strategyChild3.developmentPlanneds) @JoinColumn({ name: "strategyChild3PlannedId" }) strategyChild3Planned: StrategyChild3; @Column({ nullable: true, length: 40, comment: "คีย์นอก(FK)ของตาราง strategyChild4 เป้าหมายตามแผน", default: null, }) strategyChild4PlannedId: string; @ManyToOne(() => StrategyChild4, (strategyChild4) => strategyChild4.developmentPlanneds) @JoinColumn({ name: "strategyChild4PlannedId" }) strategyChild4Planned: StrategyChild4; @Column({ nullable: true, length: 40, comment: "คีย์นอก(FK)ของตาราง strategyChild5 เป้าหมายตามแผน", default: null, }) strategyChild5PlannedId: string; @ManyToOne(() => StrategyChild5, (strategyChild5) => strategyChild5.developmentPlanneds) @JoinColumn({ name: "strategyChild5PlannedId" }) strategyChild5Planned: StrategyChild5; @Column({ nullable: true, length: 40, comment: "คีย์นอก(FK)ของตาราง strategyChild1 เป้าหมายตามจริง", default: null, }) strategyChild1ActualId: string; @ManyToOne(() => StrategyChild1, (strategyChild1) => strategyChild1.developmentActuals) @JoinColumn({ name: "strategyChild1ActualId" }) strategyChild1Actual: StrategyChild1; @Column({ nullable: true, length: 40, comment: "คีย์นอก(FK)ของตาราง strategyChild2 เป้าหมายตามจริง", default: null, }) strategyChild2ActualId: string; @ManyToOne(() => StrategyChild2, (strategyChild2) => strategyChild2.developmentActuals) @JoinColumn({ name: "strategyChild2ActualId" }) strategyChild2Actual: StrategyChild2; @Column({ nullable: true, length: 40, comment: "คีย์นอก(FK)ของตาราง strategyChild3 เป้าหมายตามจริง", default: null, }) strategyChild3ActualId: string; @ManyToOne(() => StrategyChild3, (strategyChild3) => strategyChild3.developmentActuals) @JoinColumn({ name: "strategyChild3ActualId" }) strategyChild3Actual: StrategyChild3; @Column({ nullable: true, length: 40, comment: "คีย์นอก(FK)ของตาราง strategyChild4 เป้าหมายตามจริง", default: null, }) strategyChild4ActualId: string; @ManyToOne(() => StrategyChild4, (strategyChild4) => strategyChild4.developmentActuals) @JoinColumn({ name: "strategyChild4ActualId" }) strategyChild4Actual: StrategyChild4; @Column({ nullable: true, length: 40, comment: "คีย์นอก(FK)ของตาราง strategyChild5 เป้าหมายตามจริง", default: null, }) strategyChild5ActualId: string; @ManyToOne(() => StrategyChild5, (strategyChild5) => strategyChild5.developmentActuals) @JoinColumn({ name: "strategyChild5ActualId" }) strategyChild5Actual: StrategyChild5; @Column({ type: "longtext", nullable: true, comment: "การติดตามความก้าวหน้า", default: null, }) progressTracking: string; @Column({ type: "longtext", nullable: true, comment: "การประเมินผลโครงการ", default: null, }) projectEvaluation: string; @Column({ type: "longtext", nullable: true, comment: "ปัญหาอุปสรรค", default: null, }) obstacle: string; @Column({ type: "longtext", nullable: true, comment: "ข้อเสนอแนะ", default: null, }) suggestion: string; } export class CreateDevelopment { @Column() year: number; @Column() projectName: string; @Column() node: number; @Column() nodeId: string; @Column() orgRevisionId: string; } export class UpdateDevelopment1 { @Column() year: number; @Column() projectName: string; @Column() reason: string | null; @Column() objective: string | null; @Column() node: number; @Column() nodeId: string; @Column() orgRevisionId: string; } export class UpdateDevelopment2_1 { @Column() actualGoals: CreateActualGoal[]; @Column() plannedGoals: CreatePlannedGoal[]; } export class UpdateDevelopment2_2 { @Column() actualPeoples: CreateActualPeople[]; @Column() plannedPeoples: CreatePlannedPeople[]; } export class UpdateDevelopment3 { //move from tab5 @Column() dateStart: Date | null; @Column() dateEnd: Date | null; @Column() totalDate: number | null; @Column() developmentAddresss: CreateDevelopmentAddress[]; //end @Column() developmentProjectTypes?: string[]; @Column() projectModalActual?: number | null; @Column() projectModalPlanned?: number | null; @Column() isBackPlanned?: boolean | null; @Column() isHoldPlanned?: boolean | null; @Column() projectDayBackPlanned?: number | null; @Column() projectDayHoldPlanned?: number | null; @Column() projectNigthHoldPlanned?: number | null; @Column() developmentProjectTechniquePlanneds?: string[]; @Column() reasonPlanned70?: string; @Column() reasonPlanned20?: string; @Column() reasonPlanned10?: string; @Column() isReasonPlanned70?: string; @Column() isReasonPlanned20?: string; @Column() isReasonPlanned10?: string; @Column() isBackActual?: boolean | null; @Column() isHoldActual?: boolean | null; @Column() projectDayBackActual?: number | null; @Column() projectDayHoldActual?: number | null; @Column() projectNigthHoldActual?: number | null; @Column() developmentProjectTechniqueActuals?: string[]; @Column() reasonActual70?: string; @Column() reasonActual20?: string; @Column() reasonActual10?: string; @Column() isReasonActual70?: boolean; @Column() isReasonActual20?: boolean; @Column() isReasonActual10?: boolean; @Column() strategyChildPlannedId?: string | null; @Column() strategyChildPlannedNode?: number | null; @Column() strategyChildActualId?: string | null; @Column() strategyChildActualNode?: number | null; } export class UpdateDevelopment4 { // @Column() // developmentEvaluations: CreateDevelopmentEvaluation[]; //new @Column() progressTracking: string | null; @Column() projectEvaluation: string | null; //end } export class UpdateDevelopment5 { //new @Column() obstacle: string | null; @Column() suggestion: string | null; //end //move from tab4 @Column() project: string | null; @Column() isPassAllocate: boolean; @Column() isPassNoAllocate: boolean; @Column() isNoPass: boolean; @Column() isBudget: boolean; @Column() isOutBudget: boolean; //end } export class UpdateDevelopment7 { //move from tab5 @Column() budget: string | null; @Column() budgetSub: string | null; @Column() budgetPay: Double | null; @Column() accept: Double | null; @Column() receive: Double | null; @Column() approved: Double | null; //end } export class UpdateDevelopment8_1 { //move from tab5 @Column() issues: string | null; @Column() chance: number | null; @Column() effects: number | null; @Column() riskLevel: string | null; @Column() riskManagement: string | null; //end } export class UpdateDevelopment8 { @Column() expect: string | null; }