# 出差管理

處理員工出差申請與相關資料查詢，包括：出差資料查詢、出差單寫入。

## 取得員工出差資料

> \`\`\`\
> empBiz = {\
> &#x20; "EMP\_BIZ\_ID": number,       //員工出差資料檔\_ID\
> &#x20; "EMP\_BIZ\_TRIP\_ID": number,  //員工出差行程明細檔\_ID\
> &#x20; "CO\_ID": number,            //公司\_ID\
> &#x20; "EMP\_ID": number,           //員工\_ID\
> &#x20; "EMP\_NO": string,           //員工編號\
> &#x20; "BIZ\_PROPERTY\_ID": number,  //出差性質\_ID\
> &#x20; "AGENT\_ID": number,         //職務代理人\_ID\
> &#x20; "BIZ\_START": date,          //出差起始時間\
> &#x20; "BIZ\_END": date,            //出差結束時間\
> &#x20; "BIZ\_VALUE": number,        //合計出差時數\
> &#x20; "UNIT": string,             //出差時數單位\
> &#x20; "REQUEST\_TYPE": number,     //申請類型 1:單點出差  2:多停點出差\
> &#x20; "BIZ\_AREA\_ID": number,      //出差地點\_ID\
> &#x20; "BIZ\_TRANS\_IDS": string,    //交通工具\_IDS\
> &#x20; "BIZ\_TODO\_IDS": string,     //委辦事項\_IDS\
> &#x20; "REASON": string,           //出差原因\
> &#x20; "FILES": array,             //附件\
> &#x20; "BIZ\_SOURCE": number,       //資料來源 1:資料輸入 2:資料匯入 6:電子表單 7:介接\
> &#x20; "WF\_NO":string,             //WORKFLOW 表單編號\
> &#x20; "WF\_RESULT": number,        //表單狀態 1:在途中 2:已核准\
> &#x20; "WF\_SIGN\_TIME": date,       //簽核完成時間\
> &#x20; "IS\_ALL\_CANCEL": number,    //是否完全銷假 0:否  1:是\
> &#x20; "E\_EMP\_ID": number,         //修改\_員工\_ID        \
> &#x20; "E\_EMP\_NO": string,         //修改\_員工編號\
> &#x20; "C\_DATETIME": date,         //新增\_日期\
> &#x20; "E\_DATETIME": date,         //修改\_日期\
> },\
> \`\`\`<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 的欄位、格式是否完整及正確)"},"499":{"description":"DB錯誤 `{ code: 499, msg: string }`"},"500":{"description":"系統異常 `{ code: 500, msg: string }`"}}},"paths":{"/api/am/emp_biz":{"post":{"tags":["出差管理"],"summary":"取得員工出差資料","description":"```\nempBiz = {\n  \"EMP_BIZ_ID\": number,       //員工出差資料檔_ID\n  \"EMP_BIZ_TRIP_ID\": number,  //員工出差行程明細檔_ID\n  \"CO_ID\": number,            //公司_ID\n  \"EMP_ID\": number,           //員工_ID\n  \"EMP_NO\": string,           //員工編號\n  \"BIZ_PROPERTY_ID\": number,  //出差性質_ID\n  \"AGENT_ID\": number,         //職務代理人_ID\n  \"BIZ_START\": date,          //出差起始時間\n  \"BIZ_END\": date,            //出差結束時間\n  \"BIZ_VALUE\": number,        //合計出差時數\n  \"UNIT\": string,             //出差時數單位\n  \"REQUEST_TYPE\": number,     //申請類型 1:單點出差  2:多停點出差\n  \"BIZ_AREA_ID\": number,      //出差地點_ID\n  \"BIZ_TRANS_IDS\": string,    //交通工具_IDS\n  \"BIZ_TODO_IDS\": string,     //委辦事項_IDS\n  \"REASON\": string,           //出差原因\n  \"FILES\": array,             //附件\n  \"BIZ_SOURCE\": number,       //資料來源 1:資料輸入 2:資料匯入 6:電子表單 7:介接\n  \"WF_NO\":string,             //WORKFLOW 表單編號\n  \"WF_RESULT\": number,        //表單狀態 1:在途中 2:已核准\n  \"WF_SIGN_TIME\": date,       //簽核完成時間\n  \"IS_ALL_CANCEL\": number,    //是否完全銷假 0:否  1:是\n  \"E_EMP_ID\": number,         //修改_員工_ID        \n  \"E_EMP_NO\": string,         //修改_員工編號\n  \"C_DATETIME\": date,         //新增_日期\n  \"E_DATETIME\": date,         //修改_日期\n},\n```\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["CO_ID","BIZ_START","BIZ_END"],"properties":{"CO_ID":{"type":"integer","description":"公司ID"},"BIZ_START":{"type":["string","date"],"description":"出差起始時間"},"BIZ_END":{"type":["string","date"],"description":"出差結束時間"},"EMP_ID":{"type":"integer","description":"員工ID"},"LIMIT":{"type":"integer","description":"筆數限制"}}}}}},"responses":{"200":{"description":"成功\n```\n{\n  code: 200,\n  data: {empBiz},\n}\n```\n"},"401":{"$ref":"#/components/responses/401"},"403":{"$ref":"#/components/responses/403"},"440":{"$ref":"#/components/responses/440"},"499":{"$ref":"#/components/responses/499"},"500":{"$ref":"#/components/responses/500"}}}}}}
````

## 取得出差合計單位數

> \`\`\`\
> leaveTime = {\
> &#x20; CO\_ID: number,               //公司\_ID\
> &#x20; EMP\_ID: number,              //員工\_ID\
> &#x20; LEAVE\_VALUE: number,         //合計出差單位數\
> &#x20; LEAVE\_MINS: number,          //合計出差分鐘數\
> &#x20; DED\_VALUE: number,           //合計扣除分鐘數\
> &#x20; UNIT: string,                //出差單位\
> &#x20; RULE: string,                //規則\
> &#x20; MSG: string,                 //錯誤訊息(RULE為，warning時顯示提示訊息, error時則顯示錯誤訊息)\
> }\
> \
> 檢查代理期間可請假\
> RULE: 'warning' (提示訊息)\
> MSG: '部分或全部的出差時間已擔任其他同仁的職務代理人'\
> \
> RULE: 'error' (錯誤訊息)\
> MSG: '部分或全部的出差時間已擔任其他同仁的職務代理人'\
> \
> \`\`\`<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 的欄位、格式是否完整及正確)"},"499":{"description":"DB錯誤 `{ code: 499, msg: string }`"},"500":{"description":"系統異常 `{ code: 500, msg: string }`"}}},"paths":{"/api/wf/wf100/leaveTime":{"post":{"tags":["出差管理"],"summary":"取得出差合計單位數","description":"```\nleaveTime = {\n  CO_ID: number,               //公司_ID\n  EMP_ID: number,              //員工_ID\n  LEAVE_VALUE: number,         //合計出差單位數\n  LEAVE_MINS: number,          //合計出差分鐘數\n  DED_VALUE: number,           //合計扣除分鐘數\n  UNIT: string,                //出差單位\n  RULE: string,                //規則\n  MSG: string,                 //錯誤訊息(RULE為，warning時顯示提示訊息, error時則顯示錯誤訊息)\n}\n\n檢查代理期間可請假\nRULE: 'warning' (提示訊息)\nMSG: '部分或全部的出差時間已擔任其他同仁的職務代理人'\n\nRULE: 'error' (錯誤訊息)\nMSG: '部分或全部的出差時間已擔任其他同仁的職務代理人'\n\n```\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["CO_ID","EMP_ID","BIZ_START","BIZ_END"],"properties":{"CO_ID":{"type":"integer","description":"公司ID"},"EMP_ID":{"type":"integer","description":"員工ID"},"BIZ_START":{"type":"string","description":"出差起始時間字串 YYYY/MM/DD HH:mm"},"BIZ_END":{"type":"string","description":"出差結束時間字串 YYYY/MM/DD HH:mm"}}}}}},"responses":{"200":{"description":"成功\n```\n{\n  code: 200,\n  data: { leaveTime },\n}\n```\n"},"401":{"$ref":"#/components/responses/401"},"403":{"$ref":"#/components/responses/403"},"440":{"$ref":"#/components/responses/440"},"490":{"description":"失敗\n```\n{\n  code: 490,\n  msg: string,   // 失敗原因\n}\n```      \n"},"499":{"$ref":"#/components/responses/499"},"500":{"$ref":"#/components/responses/500"}}}}}}
````

## 出差單檢查

> requestBody 的 REQUEST\_TYPE 說明\
> \`\`\`\
> 1、若REQUEST\_TYPE為1(整體出差行程)，bizTrips為\[]，需求欄位:\
> &#x20; BIZ\_PROPERTY\_ID、AGENT\_ID、BIZ\_DATETIME、BIZ\_TRANS\_IDS、\
> &#x20; BIZ\_TODO\_IDS、BIZ\_AREA\_ID、REASON、REQUEST\_TYPE\
> \
> 2、若REQUEST\_TYPE為2(詳細出差行程)，需求欄位:\
> &#x20; BIZ\_PROPERTY\_ID、AGENT\_ID、BIZ\_DATETIME、BIZ\_TRANS\_IDS、\
> &#x20; BIZ\_TODO\_IDS、REQUEST\_TYPE、BIZ\_TRIPS  \
> \
> EMP\_BIZ\_ID 編輯模式為必填\
> \`\`\`<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 的欄位、格式是否完整及正確)"},"499":{"description":"DB錯誤 `{ code: 499, msg: string }`"},"500":{"description":"系統異常 `{ code: 500, msg: string }`"}}},"paths":{"/api/wf/wf100/checkBiz":{"post":{"tags":["出差管理"],"summary":"出差單檢查","description":"requestBody 的 REQUEST_TYPE 說明\n```\n1、若REQUEST_TYPE為1(整體出差行程)，bizTrips為[]，需求欄位:\n  BIZ_PROPERTY_ID、AGENT_ID、BIZ_DATETIME、BIZ_TRANS_IDS、\n  BIZ_TODO_IDS、BIZ_AREA_ID、REASON、REQUEST_TYPE\n\n2、若REQUEST_TYPE為2(詳細出差行程)，需求欄位:\n  BIZ_PROPERTY_ID、AGENT_ID、BIZ_DATETIME、BIZ_TRANS_IDS、\n  BIZ_TODO_IDS、REQUEST_TYPE、BIZ_TRIPS  \n\nEMP_BIZ_ID 編輯模式為必填\n```\n","requestBody":{"require":true,"content":{"application/json":{"schema":{"type":"object","properties":{"BIZ_PROPERTY_ID":{"type":"number","description":"出差性質 ID"},"BIZ_DATETIME":{"type":"array","minLength":"2,","maxLength":"2,","items":{"type":"string","description":"出差申請日期時間起迄的字串 YYYY/MM/DD HH:mm"}},"AGENT_ID":{"type":"number","description":"職務代理人 ID"},"BIZ_TRANS_IDS":{"type":"string","description":"交通工具 IDS"},"BIZ_TODO_IDS":{"type":"string","description":"委辦事項 IDS"},"REQUEST_TYPE":{"type":"integer","description":"申請類型 { 1:整體出差行程 2:詳細出差行程 }"},"BIZ_AREA_ID":{"type":"number","description":"出差地點 ID"},"REASON":{"type":"string","maxLength":300,"description":"出差原因"},"BIZ_TRIPS":{"type":"array","description":"詳細出差行程","items":{"type":"object","properties":{"TRIP_AREA_ID":{"type":"number","description":"該行程出差地點 ID"},"TRIP_DATETIME":{"type":"array","minLength":"2,","maxLength":"2,","items":{"type":"string","description":"該行程出差申請日期時間起迄的字串 YYYY/MM/DD HH:mm"}},"TRIP_REASON":{"type":"string","maxLength":300,"description":"該行程出差原因"},"SEQ":{"type":"integer","description":"第幾段行程"}}}},"FILES":{"type":"array","description":"附件，塞入 /api/file/attach 取得的物件(funCode為wf100)","items":{"type":"object","properties":{"fileUUID":{"type":"string"},"fileName":{"type":"string"},"fileSize":{"type":"number"},"fileMime":{"type":"string"},"isTmp":{"type":"integer"}}}},"EMP_BIZ_ID":{"type":"integer","description":"出差主檔id"},"WF_NO":{"type":"string","description":"WORKFLOW 表單編號"},"WF_RESULT":{"type":"integer","description":"表單狀態 { 1:在途中 2:已核准 }"}}}}}},"responses":{"200":{"description":"成功"},"401":{"$ref":"#/components/responses/401"},"403":{"$ref":"#/components/responses/403"},"440":{"$ref":"#/components/responses/440"},"490":{"description":"失敗\n```\n{\n  code: 490,\n  msg: string,   // 失敗原因\n}\n```                                                   \n"},"499":{"$ref":"#/components/responses/499"},"500":{"$ref":"#/components/responses/500"}}}}}}
````

## 出差單申請

> requestBody 的 REQUEST\_TYPE 說明\
> \`\`\`\
> 1、若REQUEST\_TYPE為1(整體出差行程)，bizTrips為\[]，需求欄位:\
> &#x20; BIZ\_PROPERTY\_ID、AGENT\_ID、BIZ\_DATETIME、BIZ\_TRANS\_IDS、\
> &#x20; BIZ\_TODO\_IDS、BIZ\_AREA\_ID、REASON、REQUEST\_TYPE、WF\_NO、WF\_RESULT\
> \
> 2、若REQUEST\_TYPE為2(詳細出差行程)，需求欄位:\
> &#x20; BIZ\_PROPERTY\_ID、AGENT\_ID、BIZ\_DATETIME、BIZ\_TRANS\_IDS、\
> &#x20; BIZ\_TODO\_IDS、REQUEST\_TYPE、BIZ\_TRIPS、WF\_NO、WF\_RESULT\
> \
> EMP\_BIZ\_ID 編輯模式為必填        \
> \`\`\`<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 的欄位、格式是否完整及正確)"},"499":{"description":"DB錯誤 `{ code: 499, msg: string }`"},"500":{"description":"系統異常 `{ code: 500, msg: string }`"}}},"paths":{"/api/wf/wf100/insertBiz":{"post":{"tags":["出差管理"],"summary":"出差單申請","description":"requestBody 的 REQUEST_TYPE 說明\n```\n1、若REQUEST_TYPE為1(整體出差行程)，bizTrips為[]，需求欄位:\n  BIZ_PROPERTY_ID、AGENT_ID、BIZ_DATETIME、BIZ_TRANS_IDS、\n  BIZ_TODO_IDS、BIZ_AREA_ID、REASON、REQUEST_TYPE、WF_NO、WF_RESULT\n\n2、若REQUEST_TYPE為2(詳細出差行程)，需求欄位:\n  BIZ_PROPERTY_ID、AGENT_ID、BIZ_DATETIME、BIZ_TRANS_IDS、\n  BIZ_TODO_IDS、REQUEST_TYPE、BIZ_TRIPS、WF_NO、WF_RESULT\n\nEMP_BIZ_ID 編輯模式為必填        \n```\n","requestBody":{"require":true,"content":{"application/json":{"schema":{"type":"object","properties":{"BIZ_PROPERTY_ID":{"type":"number","description":"出差性質 ID"},"BIZ_DATETIME":{"type":"array","minLength":"2,","maxLength":"2,","items":{"type":"string","description":"出差申請日期時間起迄的字串 YYYY/MM/DD HH:mm"}},"AGENT_ID":{"type":"number","description":"職務代理人 ID"},"BIZ_TRANS_IDS":{"type":"string","description":"交通工具 IDS"},"BIZ_TODO_IDS":{"type":"string","description":"委辦事項 IDS"},"REQUEST_TYPE":{"type":"integer","description":"申請類型 { 1:整體出差行程 2:詳細出差行程 }"},"BIZ_AREA_ID":{"type":"number","description":"出差地點 ID"},"REASON":{"type":"string","maxLength":300,"description":"出差原因"},"BIZ_TRIPS":{"type":"array","description":"詳細出差行程","items":{"type":"object","properties":{"TRIP_AREA_ID":{"type":"number","description":"該行程出差地點 ID"},"TRIP_DATETIME":{"type":"array","minLength":"2,","maxLength":"2,","items":{"type":"string","description":"該行程出差申請日期時間起迄的字串 YYYY/MM/DD HH:mm"}},"TRIP_REASON":{"type":"string","maxLength":300,"description":"該行程出差原因"},"SEQ":{"type":"integer","description":"第幾段行程"}}}},"FILES":{"type":"array","description":"附件，塞入 /api/file/attach 取得的物件(funCode為wf100)","items":{"type":"object","properties":{"fileUUID":{"type":"string"},"fileName":{"type":"string"},"fileSize":{"type":"number"},"fileMime":{"type":"string"},"isTmp":{"type":"integer"}}}},"EMP_BIZ_ID":{"type":"integer","description":"出差主檔id"},"WF_NO":{"type":"string","description":"WORKFLOW 表單編號"},"WF_RESULT":{"type":"integer","description":"表單狀態 { 1:在途中 2:已核准 }"}}}}}},"responses":{"201":{"description":"申請成功 (等待人員簽核中...)"},"401":{"$ref":"#/components/responses/401"},"403":{"$ref":"#/components/responses/403"},"440":{"$ref":"#/components/responses/440"},"490":{"description":"失敗\n```\n{\n  code: 490,\n  msg: string,   // 失敗原因\n}\n```\n"},"498":{"description":"`{ code: 498, msg: '伺服器錯誤' }`"},"499":{"$ref":"#/components/responses/499"},"500":{"$ref":"#/components/responses/500"}}}}}}
````

## 出差單刪除

> \`\`\`\
> deleteLeave = {\
> &#x20; "RETURN\_CODE": number,  //回傳訊息代號\
> &#x20; "RETURN\_MSG": 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 的欄位、格式是否完整及正確)"},"499":{"description":"DB錯誤 `{ code: 499, msg: string }`"},"500":{"description":"系統異常 `{ code: 500, msg: string }`"}}},"paths":{"/api/wf/wf100/deleteBiz":{"post":{"tags":["出差管理"],"summary":"出差單刪除","description":"```\ndeleteLeave = {\n  \"RETURN_CODE\": number,  //回傳訊息代號\n  \"RETURN_MSG\": string,   //回傳訊息\n},\n```\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["CO_ID","EMP_ID","EMP_BIZ_ID"],"properties":{"CO_ID":{"type":"integer","description":"公司ID"},"EMP_ID":{"type":"integer","description":"員工ID"},"EMP_BIZ_ID":{"type":"integer","description":"出差主檔ID"}}}}}},"responses":{"200":{"description":"成功\n```\n{\n  code: 200\n}\n```\n"},"401":{"$ref":"#/components/responses/401"},"403":{"$ref":"#/components/responses/403"},"440":{"$ref":"#/components/responses/440"},"490":{"description":"失敗\n```\n{\n  code: 490,\n  msg: string,   // 失敗原因\n}\n```\n"},"499":{"$ref":"#/components/responses/499"},"500":{"$ref":"#/components/responses/500"}}}}}}
````
