Skip to Content
🚀 Welcome to Humansoft Open API Documentation

Get Monthly Schedule

ดึงตารางกะการทำงานรายเดือนของพนักงาน

ใช้ API นี้เพื่อดูว่าพนักงานมีกะอะไรในแต่ละวันของเดือน พร้อมสิทธิ์ในการเปลี่ยนกะ

Endpoint

GET /api/v1/open-apis/work-cycle/get-employee-work-cycle-month

Request Parameters

ParameterTypeRequiredDescriptionExample
employee_codestringYesรหัสพนักงานEMP001
month_nostringYesเดือนที่ต้องการ (YYYY-MM)2026-01

Response Format

Success Response (HTTP 200)

{ "code": 200, "message": "สำเร็จ", "payload": { "time_range": { "start_date": "2026-01-01", "end_date": "2026-01-31", "day_range": 31 }, "employee": { "profile": { "employee_id": "RU1QMDE=", "employee_code": "EMP001", "employee_name": "สมชาย", "employee_last_name": "ใจดี", "employee_nickname": "ชาย", "photograph": "https://example.com/photos/emp001.jpg" }, "daily": [ { "date": "2026-01-01", "time_attendance_group_transac_id": "1001", "work_cycle_code": "A", "work_cycle_id": "V0MwMDE=", "master_salary_report_id": "50", "is_change_work_cycle": "Y" }, { "date": "2026-01-02", "time_attendance_group_transac_id": "1002", "work_cycle_code": "A", "work_cycle_id": "V0MwMDE=", "master_salary_report_id": "50", "is_change_work_cycle": "Y" }, { "date": "2026-01-03", "time_attendance_group_transac_id": null, "work_cycle_code": null, "work_cycle_id": null, "master_salary_report_id": null, "is_change_work_cycle": "Y" } ] } } }

Error Response - Missing Parameter (HTTP 400)

{ "code": 400, "message": "ไม่สำเร็จ", "error": "Missing required parameter: employee_code" }

Error Response - Invalid Format (HTTP 400)

{ "code": 400, "message": "ไม่สำเร็จ", "error": "Invalid month_no format. Expected format: YYYY-MM (e.g., 2026-01)" }

Error Response - Employee Not Found (HTTP 400)

{ "code": 400, "message": "ไม่สำเร็จ", "error": "Employee not found with code: EMP999" }

Response Fields

time_range

FieldTypeDescription
start_datestringวันที่เริ่มต้นรอบ (YYYY-MM-DD)
end_datestringวันที่สิ้นสุดรอบ (YYYY-MM-DD)
day_rangenumberจำนวนวันในรอบ

employee.profile

FieldTypeDescription
employee_idstringID ของพนักงาน (Base64)
employee_codestringรหัสพนักงาน
employee_namestringชื่อพนักงาน
employee_last_namestringนามสกุลพนักงาน
employee_nicknamestringชื่อเล่นพนักงาน
photographstringURL รูปภาพพนักงาน

employee.daily[]

FieldTypeDescription
datestringวันที่ (YYYY-MM-DD)
time_attendance_group_transac_idstringID ธุรกรรมเวลาทำงาน
work_cycle_codestringรหัสกะ (null = หยุด)
work_cycle_idstringID ของกะ (null = หยุด)
master_salary_report_idstringID รอบเงินเดือน
is_change_work_cyclestringสามารถเปลี่ยนกะได้หรือไม่ (Y/N)

Code Examples

curl -X GET "https://openapi.humansoft.co.th/api/v1/open-apis/work-cycle/get-employee-work-cycle-month?employee_code=EMP001&month_no=2026-01" \ -H "Ocp-Apim-Subscription-Key: YOUR_API_KEY"

is_change_work_cycle

ตรวจสอบ is_change_work_cycle ก่อนแสดง UI ให้แก้ไขกะ

ValueDescription
Yสามารถเปลี่ยนกะได้
Nไม่สามารถเปลี่ยนกะได้

สาเหตุที่เปลี่ยนไม่ได้:

  • เกิน Cut-off date ที่กำหนด
  • รอบเงินเดือนถูกล็อค
  • เป็นข้อมูลในอดีต

Validation Rules

ParameterValidationError Message
employee_codeต้องระบุและเป็น stringMissing required parameter: 'employee_code'
month_noต้องเป็นรูปแบบ YYYY-MMInvalid month_no format. Expected format: YYYY-MM

Error Handling

ErrorCauseSolution
Missing required parameter: employee_codeไม่ได้ส่ง employee_codeตรวจสอบ query parameter
Missing required parameter: month_noไม่ได้ส่ง month_noระบุเดือนที่ต้องการ
Invalid month_no formatรูปแบบเดือนไม่ถูกต้องใช้รูปแบบ YYYY-MM
Employee not found with code: XXXไม่พบพนักงานตรวจสอบ employee_code

Notes

Use Cases

  1. แสดงปฏิทินกะ - แสดงตารางกะในรูปแบบปฏิทิน
  2. ตรวจสอบสิทธิ์เปลี่ยนกะ - ดูว่าวันไหนเปลี่ยนกะได้
  3. วางแผนตารางงาน - ดูภาพรวมกะของพนักงาน

Salary Period

  • start_date และ end_date ขึ้นอยู่กับการตั้งค่ารอบเงินเดือน
  • ไม่จำเป็นต้องตรงกับวันที่ 1 และสิ้นเดือน

Missing Days

  • วันที่ไม่มีข้อมูลจะมีค่าเป็น null
  • ยังคงแสดงในรายการ daily เพื่อให้ครบทุกวัน
Last updated on