# 班表管理

管理員工班表資料，包括：班表資料查詢。

## 取得員工班別展開

> \`\`\`\
> emp\_worktime = {\
> &#x20; "CO\_ID": number,                //公司\_ID\
> &#x20; "EMP\_ID": number,               //員工\_ID\
> &#x20; "WORK\_DATE":date,               //應出勤日期\
> &#x20; "WORK\_DATE\_SEQ": number,        //應出勤日期\_分段\
> &#x20; "IS\_EMPTY\_WORKTIME": number,    //當日是否未排班\
> &#x20; "IS\_EMPTY\_CALENDAR": number,    //當日是否未設定行事曆\
> &#x20; "WORK\_DATE\_WEEK": number,       //應出勤日期\_星期\
> &#x20; "SHIFT\_TYPE": number,           //員工班別屬性\
> &#x20; "SHIFT\_ID": number,             //員工班別\_ID\
> &#x20; "CALENDAR\_BASIC\_ID": number,    //員工行事曆\_ID\
> &#x20; "CALENDAR\_LEAVE\_ID": number,    //員工行事曆類別\_ID\
> &#x20; "WORK\_LABEL\_IDS": string,       //班別標籤\
> &#x20; "IS\_LEAVE\_OVERTIME": number,    //行事曆可否加班\
> &#x20; "WORKDAY\_STIME":date,           //班別曆日區間-起\
> &#x20; "WORKDAY\_ETIME":date,           //班別曆日區間-迄\
> &#x20; "CLOCK\_FIRST\_TIME":date,        //班別最早有效刷卡時間起\
> &#x20; "CLOCK\_LAST\_TIME":date,         //班別最晚有效刷卡時間迄\
> &#x20; "WORKTIME\_START":date,          //上班時間起\
> &#x20; "WORKTIME\_END":date,            //上班時間迄\
> &#x20; "WORK\_HOURS": number,           //班別時數\
> &#x20; "REAL\_HOURS": number,           //當日班別時數時數\
> &#x20; "PAY\_TYPE": string,             //加班支領方式\
> },\
> \`\`\`<br>

````json
{"openapi":"3.0.0","tags":[{"name":"班表管理","description":"管理員工班表資料，包括：班表資料查詢。"}],"servers":[{"url":"https://104demotest-api-server.hrmax.104.com.tw"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}},"responses":{"401":{"description":"認證失敗 (請更新 accessToken 再試一次)"},"403":{"description":"權限不足"},"440":{"description":"參數錯誤 (請檢查 parameters 或 request body 的欄位、格式是否完整及正確)"},"500":{"description":"系統異常 `{ code: 500, msg: string }`"}}},"paths":{"/api/am/emp_worktime":{"post":{"tags":["班表管理"],"summary":"取得員工班別展開","description":"```\nemp_worktime = {\n  \"CO_ID\": number,                //公司_ID\n  \"EMP_ID\": number,               //員工_ID\n  \"WORK_DATE\":date,               //應出勤日期\n  \"WORK_DATE_SEQ\": number,        //應出勤日期_分段\n  \"IS_EMPTY_WORKTIME\": number,    //當日是否未排班\n  \"IS_EMPTY_CALENDAR\": number,    //當日是否未設定行事曆\n  \"WORK_DATE_WEEK\": number,       //應出勤日期_星期\n  \"SHIFT_TYPE\": number,           //員工班別屬性\n  \"SHIFT_ID\": number,             //員工班別_ID\n  \"CALENDAR_BASIC_ID\": number,    //員工行事曆_ID\n  \"CALENDAR_LEAVE_ID\": number,    //員工行事曆類別_ID\n  \"WORK_LABEL_IDS\": string,       //班別標籤\n  \"IS_LEAVE_OVERTIME\": number,    //行事曆可否加班\n  \"WORKDAY_STIME\":date,           //班別曆日區間-起\n  \"WORKDAY_ETIME\":date,           //班別曆日區間-迄\n  \"CLOCK_FIRST_TIME\":date,        //班別最早有效刷卡時間起\n  \"CLOCK_LAST_TIME\":date,         //班別最晚有效刷卡時間迄\n  \"WORKTIME_START\":date,          //上班時間起\n  \"WORKTIME_END\":date,            //上班時間迄\n  \"WORK_HOURS\": number,           //班別時數\n  \"REAL_HOURS\": number,           //當日班別時數時數\n  \"PAY_TYPE\": string,             //加班支領方式\n},\n```\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["CO_ID","WORK_SDATE","WORK_EDATE","EMP_ID"],"properties":{"CO_ID":{"type":"integer","description":"公司ID"},"WORK_SDATE":{"type":["string","date"],"description":"出勤日期起"},"WORK_EDATE":{"type":["string","date"],"description":"出勤日期迄"},"EMP_ID":{"type":"integer","description":"員工ID"}}}}}},"responses":{"200":{"description":"成功\n```\n{\n  code: 200, \n  data: [emp_worktime, emp_worktime, ...]\n}\n```\n"},"401":{"$ref":"#/components/responses/401"},"403":{"$ref":"#/components/responses/403"},"440":{"$ref":"#/components/responses/440"},"500":{"$ref":"#/components/responses/500"}}}}}}
````

## 時段排班班表匯入 (行事曆別班別不合併)

> 使用說明： 依 Max 時段排班範本格式產生 excel 後，打這個 API

````json
{"openapi":"3.0.0","tags":[{"name":"班表管理","description":"管理員工班表資料，包括：班表資料查詢。"}],"servers":[{"url":"https://104demotest-api-server.hrmax.104.com.tw"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}},"responses":{"401":{"description":"認證失敗 (請更新 accessToken 再試一次)"},"403":{"description":"權限不足"},"440":{"description":"參數錯誤 (請檢查 parameters 或 request body 的欄位、格式是否完整及正確)"},"500":{"description":"系統異常 `{ code: 500, msg: string }`"}}},"paths":{"/api/am/section/import":{"post":{"tags":["班表管理"],"summary":"時段排班班表匯入 (行事曆別班別不合併)","description":"使用說明： 依 Max 時段排班範本格式產生 excel 後，打這個 API","requestBody":{"require":true,"content":{"multipart/form-data":{"schema":{"type":"object","required":["CO_ID","START_DATE","END_DATE","attachment"],"properties":{"CO_ID":{"type":"integer","description":"公司ID"},"START_DATE":{"type":"string","description":"班表日期起"},"END_DATE":{"type":"string","description":"班表日期迄"},"attachment":{"type":"string","format":"binary","description":"multipart request 的 field name 必須是 'attachment'"}}}}}},"responses":{"200":{"description":"成功\n```\n{\n  code: integer, msg: string, commitResult?: object,\n  fails?: [\n    {\n      \"empNo\": string,                  //員工編號\n      \"empName\": string,                //中文姓名\n      \"workDate\": string,               //日期\n      \"caleName\": string,               //行事曆別\n      \"error\": string,                  //錯誤資訊\n      \"swork0\": string,                 //班別1開始時間\n      \"ework0\": string,                 //班別1結束時間\n      \"lab0_0\": string,                 //班別1標籤\n      ...\n    }, ...\n  ],\n}\n```\n"},"401":{"$ref":"#/components/responses/401"},"403":{"$ref":"#/components/responses/403"},"440":{"$ref":"#/components/responses/440"},"450":{"description":"MulterError `{ code: 450, msg?: string }`"},"490":{"description":"{ code: integer, msg: string }"},"500":{"$ref":"#/components/responses/500"}}}}}}
````
