> ## Documentation Index
> Fetch the complete documentation index at: https://developer.hct.com.tw/llms.txt
> Use this file to discover all available pages before exploring further.

# 6、取消派遣 - TransDataCancel

> **版本**：v1.0.0 \
>
> **狀態**：最終版  \
>
> **最後更新日期**：2026-10-17

## 文件概述

### 文件目的

取消已上傳派遣的收貨包裹，避免包裹進入實際收貨流程

> **注意：**
>
> * 此 API 僅適用於尚未實際收取的包裹。
> * 請於包裹收取前呼叫此 API；包裹一旦完成收取，將無法再取消收貨。
> * 當天 15:00 前已成功取消派遣，當天 15:00 不會發送該貨號的取件通知。
> * 「取消派遣」 功能係屬此「貨號」不再派遣，無法用相同貨號進行「已取消派遣後，重新再下派收」

## 前置需求

* [ ] 公司帳號(company)、公司密碼(password)：向營業所申請
* [ ] 帳號有開通派遣功能

## 身分驗證

本 API 目前不提供身份驗證機制，使用者可直接依 API Specification 進行呼叫。

## API 規格總覽

* SOAP Envelope、HTTP Request Header 及 Namespace 定義請參考 **[SOAP規格](https://developer.hct.com.tw/files/logistics-share-docs/protocol-specifications/zh/soap-specification.md)**

### 支援格式

| 環境 | 網址 |
| - | - |
| 測試環境 | [https://hctrt.hct.com.tw/edi\_webservice2\_test/service1.asmx](https://hctrt.hct.com.tw/edi_webservice2_test/service1.asmx) |
| 正式環境 | [https://hctrt.hct.com.tw/edi\_webservice2/service1.asmx](https://hctrt.hct.com.tw/edi_webservice2/service1.asmx) |

| 規範項目 | 設定值 | 備註 |
| - | - | - |
| 回應逾時時間 | 60s | 伺服器處理並回傳資料的最大等待時間 |

### 資料格式

* 一次不可超過20筆
* 文字請使用utf-8

### API 端點

| 請求方法 | 端點 | SOAP 動作 | 驗證方式 | 說明 |
| - | - | - | - | - |
| POST | `/service1.asmx` | TransDataCancel\_Json | X | 支援JSON格式 |

## API 規格

### 請求格式

| 序號 | 參數 | 資料型態 | 是否必填 | 說明 | 範例 |
| - | - | - | - | - | - |
| 1 | Body | SOAP Body | Y | SOAP Request Body | `<soap12:Body> </soap12:Body>` |
| 2 | TransDataCancel\_Json | Object | Y | SOAPAction:TransDataCancel\_Json  Request 物件 | `<TransDataCancel_Json   xmlns="http://tempuri.org/"></TransDataCancel_Json  >` |

* TransDataCancel\_Json  定義

| 序號 | 參數 | 資料型態 | 是否必填 | 說明 | 範例 |
| - | - | - | - | - | - |
| 1 | company | String | Y | 公司帳號 | |
| 2 | password | String | Y | 公司密碼 | |
| 3 | json | Object | Y | 此次要更新的資料 | |

* Json Object 定義

| 序號 | 參數 | 資料型態 | 是否必填 | 說明 | 範例 |
| - | - | - | - | - | - |
| 1 | epino | String(30) | Y | 訂單編號 | 20260812000000000002 |
| 2 | edelno | String(10) | Y | 新竹貨號，純數字 | 5123456786 |

### 回應規格

| 序號 | 參數 | 資料型態 | 是否必填 | 說明 |
| - | - | - | - | - |
| 1 | success | String(1) | 結果 (Y：取消成功/N：取消失敗) | |
| 2 | edelno | String(10) | 新竹貨號 | |
| 3 | epino | String(30) | 訂單編號 | |
| 4 | ErrMsg | String(200) | 異常錯誤訊息 | |

#### HTTP 狀態碼

| 狀態碼 | 說明 |
| - | - |
| 200 | 成功 |

#### 業務錯誤代碼

| 錯誤代碼 | 說明 |
| - | - |
| 公司名稱或密碼錯誤 | |
| 無權限使用此功能 | |
| epino 不一致 | |
| 資料不存在或輸入資料錯誤 | |
| 資料錯誤請確認 | |

## SDK 與範例程式碼

### 範例

#### Request

```bash theme={null}
curl --location 'https://hctrt.hct.com.tw/edi_webservice2_test/service1.asmx' \
--header 'Content-Type: application/soap+xml; charset=utf-8' \
--data '<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
    <soap12:Body>
        <TransDataCancel_Json xmlns="http://tempuri.org/">
            <company>company</company>
            <password>password</password>
            <json>
            [
                {
                    "epino"  : "20260820000000000002",
                    "edelno" : "1004378093"
                }
            ]
            </json>
        </TransDataCancel_Json>
    </soap12:Body>
</soap12:Envelope>'
```

#### Response

```xml theme={null}
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <soap:Body>
        <TransDataCancel_JsonResponse xmlns="http://tempuri.org/">
            <TransDataCancel_JsonResult>[
  {
    "edelno": "1004378093",
    "epino": "20260820000000000002",
    "success": "Y",
    "ErrMsg": "已成功匯入 1 筆。"
  }
]</TransDataCancel_JsonResult>
        </TransDataCancel_JsonResponse>
    </soap:Body>
</soap:Envelope>
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.