ENTRY TYPE 01 ‧ FORMAL CONSUMPTION ‧ SE + AE

Type 01 正式消費進口 — 產品規格(Spec / Flow / AC / Field Mapping)

GoFreight Customs Filing Portal 完成一筆 Type 01 報關的完整規格:使用者故事、流程圖、驗收條件,以及「UI 欄位 → LDS SMS API 物件 → CBP CATAIR record」三層欄位對應。

目錄

1. 範圍與角色

Type 01(Consumption – Free & Dutiable)是最常見的正式進口報關。一筆 Type 01 由兩個 CBP 報文流組成:

兩者以同一個 Entry Number(Filer Code + Entry No)關聯,可分兩步送,或以「Certify for Cargo Release(AE 10-record 第 40 位 = A)/ Live Entry」一次送出。

1.1 資料模型階層(一筆 Entry 可含多個 Shipments)

重要:一筆 customs entry(報關單)可包含多個 shipment(多張提單)。對應 LDS CustomsEntry.Shipments : List<Shipment>(每個 Shipment = 一張 Bill of Lading);CBP 端以 Consolidated Summary Indicator(AE 10 pos42 = Y)與 Release Detail(32-record,consolidated release)把多張提單/多筆放行併入同一張 Entry Summary。每個 Shipment 下再各有多張 Invoice、每張 Invoice 多個 Line Item。
CustomsEntry (1 報關單 — header / bond / payment)  └─ Shipments : List<Shipment> (N 張提單 — 每個 = 1 Bill of Lading)     ├─ (parties: Consignee / Seller / Buyer…)     ├─ Invoices : List<ShipmentInvoice> (N 張商業發票)     │   └─ Articles : List<ShipmentArticle> (N 個行項 = 7501 line)     │       └─ Tariffs : List<ShipmentArticleTariff> (HTS 稅則)     └─ Loads : List<ShipmentLoad> (貨櫃 / 裝備)

因此 UI 必須支援「一筆 Entry 內新增多張 Shipment/Bill」,且計稅、驗證、送件都以整筆 Entry(彙總所有 shipments)為單位。

1.2 頁面架構(LDS-parity:Document Map + 分頁,100% 欄位對應)

GF Portal 的單一 Customs Entry 頁面採 LDS 同構設計:頂部 Document Map — Miller-columns(Finder 式)導覽、下方依節點顯示分頁表單,欄位逐一對應 LDS。選取節點即往右串接下一欄(Entry → Shipment → Invoice → Article → Tariff),最深選取驅動下方 detail pane。實作見 React portal(customs-entry-portal.tsx,navy 主題 scoped 於 customs-portal.css);逐欄位 → API 對照見 05_LDS_Field_API_Mapping
Customs Entry (Entry 欄 — Miller nav)  ├─ Main Info ‧ Bond info ‧ Payment info ‧ Additional (CustomsEntry)  ├─ Shipments (N) ─ Shipment [分頁 tabs: Bill ‧ Commercial entities]  │  └─ Invoices (N) ─ Invoice [Values ‧ Commercial entities]  │    └─ Articles (N) ─ Article [Values ‧ Commercial entities]  │       └─ Tariffs (N) ─ Tariff [Values ‧ Payment ‧ FTZ ‧ Sanctions ‧ P.G.A.]  ├─ Post Summary Correction ‧ Consolidated Release ‧ Cancellation  └─ Duty & Fee ‧ Result (僅編輯模式)

各層級資料物件:CustomsEntry → Shipment → ShipmentInvoice → ShipmentArticle → ShipmentArticleTariff(+ PGA / AdditionalDeclaration / CensusWarning),整棵樹由 ICustomsEntryManagerNew / Save / Get(include) / CalculateDutyAndFee / ValidateTreeById / PutToQUE 提供;關係人為 ContactIContactManager,配合 P0 TP Sync)。少數畫面欄位 LDS API 尚無對應(Liquidation、Manifested quantity、Sanctions grid、Invoice 層 party 等),於頁面以紅色標示待 LDS 確認(清單見 05 文件)。

1.2a Entity detail 分頁(as built — EntityDetail / ENTITY_LAYOUT

Detail pane 依選取的 entity kind 渲染分頁列,每個分頁含一個或多個 field group(2/3/4 欄 form grid),空 group 自動略過。as-built 的 tab → group → field 佈局如下:

EntityTabGroup欄位
ShipmentBillShipmentnumber, date, transportation_mode, carrier_id, client_ref, booking_number, importer_id, date_of_export, date_of_arrival, date_of_import, description
Quantity & In-Bondquantity, quantity_unit, in_bond_number, in_bond_date
Master / House billis_regular_bill, master_bill_issuer_id, master_bill_number, house_bill_issuer_id, house_bill_number, sub_house_bill_number
ShipmentCommercial entitiesPartiesconsignee_id, buyer_id, seller_id, ship_to_id, consolidator_id, stuffing_location_id
InvoiceValuesInvoice · Value·Currency·Rateinvoice_number;接著 invoice_value, invoice_mmv, invoice_non_dutiable, invoice_other(各含 value / currency / rate)
Commercial entitiesPartiesseller_id, ship_to_id
ArticleValuesArticle · Chargesline_item_identifier, description, client_description, country_of_origin, country_of_export, manufacturer_id, foreign_port_of_lading_id, article_set_indicator, gross_weight, special_program_claim_code, product_claim_code, article_ddp_value;article_charge_usd(可編輯,§5.5)
Commercial entitiesPartiesforeign_exporter_id, consignee_id, manufacturer_id
TariffValuesTariff · Values · Quantitiesharmonized_tariff_id, tariff_id;tariff_value, tariff_mmv, tariff_non_dutiable, tariff_other;quantity1-3 + unit_of_measure1-3
PaymentDuty & feemanual_input_duty, duty_amount, duty_rates, user_fee_accounting_class_code, user_fee_amount
FTZPrivileged foreign statusprivileged_foreign_status_harmonized_tariff_id
SanctionsSanctionssanction_disclaim_indicator
P.G.A.Partner Government Agencycheck_match_pga_values —— PGA 置於 Tariff 分頁,非 entry 層節點

注意與舊 LDS mockup 的刻意差異:Article 只有 Values + Commercial entities(無 Payment/FTZ/AD-CVD/Additional/PSC/Census 分頁);那些分頁實際位於 Tariff entity。Tariffs Miller 欄顯示完整 HTS code(由 harmonized_tariff_id 解析),非原始 id。

1.3 Customs Entry 列表檢視(List View,對照 LDS)

報關單清單頁的欄位對照 LDS Customs Entry 列表檢視:左側前四欄為狀態圖示欄(可一眼看放行/彙總/整體/稅費狀態),其後為識別與關鍵日期欄。實作見 Type01_Customs_Portal.html 的 Customs Entries 清單。真實 LDS 狀態(ACE-7532):前四個狀態欄先前永遠顯示「—」(占位);現在逐列由該 entry 的 EntityLastStatus 集合推導,與 LDS 桌面版 grid 讀的是同一份狀態列。清單 GetPage query 現在帶 Include=LastStatuses,故每一列都會帶 EntityLastStatus 集合;列 payload 新增 last_statuses 陣列(每筆含 source / status / subject / value / text / time)。下表「狀態推導」說明各欄如何由該集合計算。
列表欄位LDS 來源 / 屬性狀態推導(ACE-7532)
Entry summary(狀態圖示)EntityLastStatus(subject AE顯示 CBP「Customs status」disposition(如「Accepted in Customs」);若尚無 disposition 則 fallback 到 ABI「QUE status」(如「Incoming」)。tooltip 帶來源系統與任何 reject / disposition 文字。
Cargo release(狀態圖示)EntityLastStatus(subject SESE application 同 Entry summary 邏輯(Customs status disposition 優先,否則 fallback ABI QUE status);tooltip 顯示 disposition 文字,例如 {91} NO BILL MATCH
Entry status(狀態圖示)EntityLastStatus(rollup)整體 rollup —— 有 Customs disposition 通過時為「Accepted」、任何 error / reject 為「Rejected」、只要進入 ABI queue 為「Filed」、否則依 release date 為「Released」/「Open」。
Duty&Fee(狀態圖示)EntityLastStatus(subject Duty & Fee Calculationvalue Yes → 「Calculated」、No → 「Not calculated」、Error → 「Error」(tooltip 顯示計算錯誤文字)。
FilerCustomsEntry.EntryFilerCode
Entry numberCustomsEntry.EntryNumber
Entry date(預設排序▾)CustomsEntry.Date預設遞減排序
Entry typeCustomsEntry.EntryType01/03/11/86…
ImporterCustomsEntry.Importer → Contact
Import date / Arrival date / Release dateDateOfImport / DateOfArrival / DateOfRelease關鍵日期群
Client refCustomsEntry.ClientRef
MOTCustomsEntry.TransportationMode運輸方式
CarrierCustomsEntry.Carrier → CarrierSCAC
Payment typeCustomsEntry.PaymentType個別/日結/月結
ResponsibleCustomsEntry.ResponsiblePerson → User負責人
IdCustomsEntry.Id系統內部 ID

清單支援欄位排序、列點擊開啟單一 entry、「New Entry」新建(同採 LDS-parity 編輯器)。

1.4 Portal 左側導覽(Navigation / IA)

GoFreight 慣例:左側單一直欄導覽,分群(總覽 / 報關 / 貨運與文件 / 主檔 / 財務 / 查詢與監控)。Customs Entries 為首期主體;其餘主要功能(In-Bond、FTZ、ISF、Drawback、Shipments、Delivery Orders、DIS、Trade Partners、Reference Data、Statements、Customer Invoices、Customs Queries、Reports、Settings)依 LDS Applications 於選單預留位置並標示狀態(已建 / 進行中 / 預留)。完整導覽規劃見 06_GF_Portal_Navigation_IA.html

Entry 編輯器 document tree(as built,ACE-7519):entry 節點為 Main Info——header 與 Importer 合併,entry 層不再有獨立 Parties 節點(商業 parties 位於 Shipment 與 Article 層)。Entry 群組:Main Info · Bond · Payment · Additional infoDesignated notify party (4811) 置於 Additional info,並顯示連結的 company。PGA 不是 entry 節點——它是 Tariff 的 tab;entry 層的「PGA data included」旗標仍留在 Additional info。Document Map 採 Miller-column 導覽(Finder 式):每一層 — Shipments ▸ Shipment ▸ Invoices ▸ Invoice ▸ Articles ▸ Article ▸ Tariffs ▸ Tariff — 往右開一欄而非往下縮排,Article/Tariff label 不再被截斷。下方 detail pane 顯示最深選取的**分頁(tabs)**欄位——Shipment(Bill / Commercial entities)、Invoice(Values / Commercial entities)、Article(Values / Commercial entities)、Tariff(Values / Payment / FTZ / Sanctions / P.G.A.)。每欄含 + Add;Corrections = Post Summary Correction · Cancellation · Consolidated release;Filing = Duty & Fee · Result。(ACE-7521,option D)

Entry chrome(ACE-7522):最上方僅一行小字 — filer code · entry number(無大標題)+ 狀態 chip。Document Map 更 compact — 欄位高度砍半(≈126px;過長欄位於欄內捲動)且移除「Document Map」標題列,節省垂直空間。Save 改為**懸浮於畫面正中下方**(GoFreight FMS 式)— 一律存在、僅在有未存變更時啟用。Delete 降級為頁面最下方的低調文字連結,移出上方重要版位。

Entry tools(ACE-7524 / 7530):右上角 🛠 Tools 選單(分群,點外部 / Escape 關閉)含兩群。Tariffs:Autofill Special 99 Tariffs(Chapter 99 / Section 301 trade-remedy autofill)—— 為 compute-only round-trip(FillSpecial99CorrespondTariffs),在 entry 未存檔或有未存變更時停用(因它讀的是已存檔的 HTS codes);has_changes 時把修改後的樹帶回表單供操作員檢視後 Save。Transmit to CBP (ABI/ACE)(ACE-7533,完整動作集):傳輸子選單擴充為完整的 CustomsEntry.ActionQUE 傳輸動作集,依 ABI application 分組(見下方「Transmit 動作集」表)—— Entry Summary · AE(7501)、Cargo Release · SE(3461)、Entry Summary + Cargo Release、以及 Other ABI actions。每個 UI 動作的 action 字串原樣帶到 wire 上的 CustomsEntry.ActionQUE enum body(no allow-list)。每次傳輸皆二次把關(double-gated):UI 的 window.confirm("… — transmit to CBP via ABI/ACE? This sends to U.S. Customs."),以及請求本身帶 confirm:true 到後端。成功時頂部 banner 顯示「✓ {label} submitted to CBP.」;失敗則呈現完整 CBP/SMS fault,讓操作員看出該修什麼(state、缺資料、Add-vs-Replace)。Document Map 的 Tariffs 欄顯示完整 HTS code(由 harmonized-tariff id 解析),而非原始 id。

角色說明主要動作
報關操作員(Broker / Filer)GoFreight 客戶端使用者建檔、填寫、計稅、送件、處理 reject
主管 / 覆核送件前覆核驗證、核准 statement
系統(GF + LDS)驗證、計稅、編碼、傳輸CalculateDutyAndFee、ValidateTree、PutToQUE
CBP ABI/ACE美國海關回 SO 放行 / AX 結算 / UC 通知

2. User Stories

US-01 建立新報關單
身為報關操作員,我想在 Entry List 點「New」並自動帶入下一個 Entry Number,以便快速開單。
US-02 帶入主檔資料
身為操作員,我想從 Contact 主檔選取 IOR / Consignee / Manufacturer 與 Bond/Surety,避免重複輸入並減少 reject。
US-03 填寫多張提單
身為操作員,我想在同一筆 Entry 內新增多個 Shipment(多張 Master/House B/L),每張各填 Carrier(SCAC)、件數、貨櫃,因為一筆報關常涵蓋多張提單(consolidated entry)。
US-04 輸入 invoice 與行項
身為操作員,我想以 invoice 為單位輸入商品行項與 tariff,系統自動帶 Chapter 99 特別關稅與 SPI。
US-05 計算稅費
身為操作員,我想一鍵「Calculate Duty & Fee」算出 Duty、MPF、HMF、IR-Tax 與應付總額。
US-06 送件前驗證
身為操作員,我想「Check」同時驗證 Entry Summary 與 Cargo Release,紅叉可點開看錯誤並跳到欄位。
US-07 送件到 CBP
身為操作員,我想 QUE 同時送 Entry Summary + Cargo Release(或分送),系統入列並顯示送出狀態。
US-08 取得 CBP 回覆
身為操作員,我想在狀態看板看到 Cargo Release 放行 / Hold、Entry Summary Accept / Reject / Census Warning,以及 statement 更新。
US-09 產生文件
身為操作員,我想產生 3461、7501、Delivery Order,並上傳 DIS 補充文件。
US-10 送後修正
身為操作員,我想在放行後做 Update(bill/port)或 Post Summary Correction(PSC)。

3. End-to-End Flow Chart

① New Entry② Main Info / Bond③ Shipments (1..N)④ Invoice/Lines (per shipment)⑤ PGA (Tariff tab)?⑥ Calculate Duty & Fee⑦ Validate AE + SE⑧ Transmit (Tools)⑨ CBP Response⑩ Docs / PSC
① New Entry自動帶 Entry No ② Header / PartiesType/MOT/Port/IOR Bond InfoType 8/9 + Surety ③ Shipments (1..N)多張 Bill / 迴圈 ④ Invoice / Lines每 shipment 各自 ↻ 對每張 Bill 重複 ③→④ ⑤ 受 PGA 管制? 補 PGAMessage Set ⑥ Calculate Duty & FeeDuty / MPF(499) / HMF(501) / IR-Tax → 應付總額 ⑦ Validate Check 通過? 修正錯誤雙擊跳到欄位 ⑧ Submit / QUEAE + SE LDS 入列 → CATAIR → ABI/ACEPutToQUEOneWay(非同步) ⑨ CBP 回覆 輪詢狀態 SO: RELEASED (98) ‧ AX: Accepted (A)Statement 更新 AX: Census Warning (A/W)校正或送 Override SO: Hold/Exam ‧ AX: Reject (R/F)修正後重送 Reject / Warning → 修正 → 重送 ⑩ 產生 3461 / 7501 / DODIS 上傳 ‧ PSC / Update
關鍵分歧:⑤ PGA 在 Tariff entity 的 P.G.A. 分頁捕捉(依 HTS/商品觸發),非獨立 entry 步驟;⑥ Calculate 為 compute-only(僅在 LDS 真的回傳 totals 時才標為完成);⑦ 驗證於 Duty & Fee 節點拆成兩顆 — Validate Entry Summary("QUE AE")與 Validate Cargo Release("QUE SE"),各有 pass/fail 與可點擊的錯誤清單(跳回欄位);⑧ Transmit 由 🛠 Tools 選單發起(Add/Replace Entry Summary & Cargo Release),二次把關;⑨ CBP 三種結果(放行/接受、Census Warning、Hold/Reject),Reject 與 Warning 走修正重送回圈。(流程圖維持經典生命週期形狀;節點 ⑦/⑧ 為 as built。)

4. Acceptance Criteria

建檔與資料(US-01~04)

  1. GIVEN 在 Entry List WHEN 點 New 並按 Entry Number 的「…」THEN 系統依序列自動帶入下一個 Entry Number(8 碼含 check digit),且 Entry Type 預設 01、Bond Type 預設 9、Payment Type 預設 1
  2. IOR Number 必填,格式須符合 IRS NN-NNNNNNNXX / CBP YYDDPP-NNNNN / SSN 三者之一,否則阻擋。
  3. MOT、Port of Entry 必填(Type 01);Port of Unlading 在 MOT 為 50/60/70 時必填。
  4. 一筆 Entry 可新增多個 Shipment(多張 Bill);每個 Shipment 各有自己的提單、件數、貨櫃與 invoice/行項。新增 ≥2 個 Shipment 時,系統自動將 Consolidated Summary Indicator 設為 Y
  5. 計稅、驗證、送件皆以整筆 Entry(彙總所有 Shipment 的行項)為單位;Total Amount Due 為所有 shipment 行項加總。
  6. 每一商品行項必填 HTS(10 碼)、Country of Origin(ISO 2 碼)、Value、Quantity 與符合 HTS 的 UOM。
  7. Manufacturer(MID) 與 Consignee 可於 header(共通時)或 line level 提供,二擇一須齊備。

Bond(US-02)

  1. Bond Type = 9(單筆)時,Surety Code 與 Bond Amount 必填;= 8(連續)時帶連續保證資料;= 0 須提供 Bond Waiver Reason。

Payment(US-04, ACE-7497)

  1. Payment 是完成 entry 的必要 portal 步驟(置於 PGA 之後、Duty & Fee 之前):Payment Type、Deferred Tax Payment、Preliminary Statement Print Date / Month,以及唯讀的 Calculated fees。對應 CustomsEntry.PaymentType / DeferredTaxPayment / PreliminaryStatementPrintDate / PreliminaryStatementMonth(Date)
  2. 依 LDS manual,Preliminary Statement Print Date 為到港後第 8 個工作日(放行後重算為放行後第 8 個工作日),付款落在第 10 個工作日。
  3. 自動填入(ACE-7523):Payment 節點在 arrival date / entry date / payment type 三者皆齊全時自動呼叫 GetPreliminaryStatementDates(arrival ← CustomsEntry.DateOfArrival, entry ← CustomsEntry.Date, paymentType ← CustomsEntry.PaymentType)(經 GET /api/lookups/preliminary-statement-dates),任一輸入變更即重算(debounce),把算出的 print date 寫入欄位;periodic statement 才顯示 statement month(non-periodic 回 null)。僅在值確實不同時才寫入,開啟既有 entry 不會被誤標 dirty。另提供手動 Recompute print date 按鈕。

Shipment parties & dates(US-02~06)

  1. 每張 Shipment 卡需捕捉 CBP SE/AE 必要的 parties——Seller(seller_id)、Buyer(buyer_id)、Consignee(consignee_id),皆為 Trade-Partner / contacts directory 欄位——以及 Date of arrival(date_of_arrival)與 Date of export(date_of_export)。缺這些時 Calculate/Validate 會報缺。
  2. date_of_export(「Export date」)存在於 Shipment entity(DateOfExport)但 manifest 未含;portal 以 augmentConfig 注入 shipments config,使其能渲染且存檔正常 round-trip(亦已加入 manifest JSON,供伺服器端 first-class 支援)。
  3. Article 的 Country of export(country_of_export)以「COE」欄顯示於 Lines 表與 Invoice Wizard;Invoice 的 Value currency rate(invoice_value_currency_rate)顯示於 invoice 表頭與 Wizard。

計稅與驗證(US-05~06)

  1. WHENCalculate duty & fee THEN 系統呼叫 CalculateDutyAndFee(id) 算出 Duty、MPF(class 499)、HMF(class 501)、IR-Tax 與 Total Amount Due;金額欄唯讀(server 計算)。As built(ACE-7531/7491):Calculate 為 compute-only,該步驟僅在 LDS 真的回傳 totals 時才標為完成(200 但無 result 或 422 皆為 FAILED calc — 不標為完成)。Totals 以 4 卡 grid 顯示(Duty / MPF / HMF / Total amount due)。查詢記錄(ACE-7534):每一次 Calculate 都記入統一的 Query log(見 §6.1),含 ✓ PASSED / ✕ FAILED chip + 時間戳 + 原因;Calculate 失敗時 reason 另附修復方式(確認 entry 有 shipment → invoice → article → tariff 且每行有 HTS code 與應稅金額並已 Save,再重新計算)。
  2. 按 Check 時呼叫 ValidateTreeById(id,"QUE AE")("QUE SE"),任一失敗顯示紅叉;點開列出錯誤,雙擊錯誤列跳到對應欄位。As built(ACE-7531):Duty & Fee 節點有兩顆按鈕 — Validate Entry Summary(action "QUE AE")與 Validate Cargo Release(action "QUE SE"),各自顯示 pass/fail 與逐欄錯誤(含 SMS error code,如 6083/6127)。修正:先前版本送空 action,不對應任何 CBP edit-set 而假 pass(LDS app 卻有錯);現改送對應的 "QUE …" action。查詢記錄(ACE-7534):每一次 Validate Entry Summary 與 Validate Cargo Release 都與 Calculate 共用同一份 Query log(見 §6.1);失敗紀錄另列出 CBP edit 錯誤清單(欄位 — 訊息 [code])與「Fix:」修復方式。
  3. 驗證未通過時,QUE(送件)按鈕停用。「Validated」狀態與 Submit gate 需 AE 與 SE 皆通過

送件與回覆(US-07~08)

  1. 送件呼叫 PutToQUEOneWay(id, AddEntrySummaryAndCargoRelease)(或分送 AddEntrySummary / AddCargoRelease),UI 即時顯示「已入列」並記錄 transmission Id 與 SourceLink
  2. 系統輪詢 GetBySourceLink("CustomsEntry={id}")LastStatuses,把狀態映射到看板:Cargo Release(SO60 代碼)、Entry Summary(AX 的 A/R + severity)、Statement。
  3. AX 回 R/F(Reject/Fatal)時標紅並列出 condition code 與敘述,提供「修正並重送」;回 A/W(Census Warning)時提示需校正或送 Census Warning Override(CW02)。
  4. SO60 = 98 RELEASED 時標示貨物已放行;其他(如 29 NOT RELEASED、03 Intensive Exam、53 CBP Hold 等)顯示對應狀態與處理建議。

文件與送後(US-09~10)

  1. 放行/接受後可產生 3461、7501、Delivery Order,並可建立 DIS 文件影像封包上傳。
  2. 放行後 15 個日曆日內可送 SE 「U」更新 bill/manifest/port;不可再送「R」Replace。
  3. 可發起 Post Summary Correction(PSC),帶 reason code 與說明文字。

5. 欄位對應與說明(UI → LDS API → CBP CATAIR 三層)

M 必填C 條件必填O 選填

5.1 Header(CustomsEntry / SE10 / AE 10-11)

UI 欄位必填LDS 物件.屬性CBP record.field說明
Entry NumberMCustomsEntry.EntryNumber(+CalculateEntryNumber()SE10 11-18 / AE 10 9-168 碼含 check digit,自動序號
Filer CodeMCustomsEntry.EntryFilerCodeSE10 6-8 / AE 10 4-6CBP 指派的報關行代碼
Entry TypeMCustomsEntry.EntryType="01"SE10 20-21 / AE 10 34-35本型別固定 01
Mode of Transport (MOT)CCustomsEntry.TransportationModeSE10 37-38 / AE 10 36-3710/11 Vessel,40/41 Air,30/31 Truck…
Port of EntryCCustomsEntry.PortOfEntry(CustomsPort)SE10 50-54 / AE 10 18-21Schedule D;SE/AE 須一致
Port of UnladingCCustomsEntry.PortOfUnladingSE10 56-60MOT 50/60/70 必填
Importer of Record (IOR)MCustomsEntry.Importer(Contact)SE10 22-36 / AE 11 3-14IRS/CBP/SSN 格式
Estimated Entry ValueM(由行項彙總)SE10 40-49整票申報總值(整數美元)
Cargo Release Cert. IndicatorCActionQUE.AddEntrySummaryAndCargoReleaseAE 10 pos 40 = A以 AE 同時驅動放行
Live EntryO(送件動作)AE 10 pos 44 = Yentry+summary 同送
Consolidated Summary IndicatorC(多 Shipment 時)AE 10 pos 42 = Y一筆 Entry 併多張提單/放行時設 Y

5.2 Parties(Contact / SE30-36 / AE 11、SE50-56 line level)

UI 欄位必填LDS 物件.屬性CBP record.field說明
Importer of RecordMCustomsEntry.ImporterAE 11 IOR Number主檔帶入
ConsigneeCShipment.ConsigneeSE30 CN / AE 11 15-26header 或 line
Manufacturer / Supplier (MID)CShipment.Seller / line partySE30 MF(+SE35/36)含名稱地址;line level 必備
Buyer / Ship To / ConsolidatorOShipment.Buyer/ShipTo/ConsolidatorSE30 BY/ST/CS視交易需要
Designated Notify Party (4811)OCustomsEntry.DesignatedNotifyParty4811(designated_notify_party4811_id)AE 11 27-38退稅/通知。As built(ACE-7519):已搬到 entry 的 Additional 節點,relabel 為「Designated notify party (4811)」並顯示連結的 company(僅前端搬移此資料欄位;空的重複欄 designated_notify_party_4811_id 被移除),走 generic save 路徑 round-trip。

5.3 Bond(CustomsEntry / SE20 / AE 31)

UI 欄位必填LDS 物件.屬性CBP record.field說明
Bond TypeMCustomsEntry.BondType(預設9)SE10 39 / AE 31 pos30 無 / 8 連續 / 9 單筆
Surety Company CodeCCustomsEntry.SuretyCodeSE20 V1 / AE 31 6-8Bond Type=9 必填
Bond AmountCCustomsEntry.BondAmountSE20 AMT / AE 31 9-18單筆保證金額
Bond Waiver ReasonCCustomsEntry.BondWaiverReasonCodeAE 10 62-64Bond Type=0 時

5.4 Shipments / Bill of Lading(CustomsEntry.Shipments : List<Shipment> — 可多筆 / SE15-17)

一筆 Entry 可有多個 Shipment,每個 Shipment 為下列欄位的一組(一張提單)。多張提單併入同一 Entry 時,AE 10 pos42 Consolidated Summary Indicator = Y

UI 欄位必填LDS 物件.屬性CBP record.field說明
Bill Type (M/H/R/T/I)M(Shipment 結構)SE15 pos5Master+House 連送 M 後接 H
Master Bill Issuer (SCAC) / No.MShipment.MasterBillIssuer/MasterBillNumberSE15 6-9 / 10-59SCAC + 提單號
House Bill Issuer / No.CShipment.HouseBillIssuer/HouseBillNumberSE15 (H)有 house 時
Carrier / Voyage-FlightCCustomsEntry.Carrier/ConveyanceName/TripIdentifierSE16non-AMS bill 必填
Quantity (packages)MShipmentInvoice.Quantity/UnitSE15 60-67最小包裝單位
Container / EquipmentOShipment.Loads(ShipmentLoad)SE17櫃號

5.5 Invoice / Line Item / Tariff(ShipmentInvoice → Article → Tariff / SE40-60 / AE 40-50)

UI 欄位必填LDS 物件.屬性CBP record.field說明
Invoice No / Value / CurrencyCShipmentInvoice.InvoiceNumber/InvoiceValue/CurrencyAE 42 Invoice Ref幣別自動換 USD
Invoice charges:MMV /Non-dutiable(運費 = 國際運費 + 保險)/ OtherOShipmentInvoice.InvoiceMMV / InvoiceNonDutiable / InvoiceOther(各含 *Currency + *CurrencyRate)value 加項 / 扣項MMV = 加項(assists/packing);Non-dutiable = 國際運費 + 保險(「shipping charges」),為扣項;各有自己的 currency + rate
Line IdentifierMShipmentArticle(line)SE40 5-7 / AE 40 5-7由 001 起,唯一
Country of Origin (COO)MShipmentArticle.COOSE40 8-9 / AE 40 9-10ISO 2 碼
Commercial DescriptionMline descriptionSE40 11-80 / AE 44商品說明
HTS Number (10-digit)MShipmentArticleTariff.HarmonizedTariffSE60 5-14 / AE 50 3-12Chapter 99 先於 1-97
Line ValueMShipmentArticleTariff.TariffValue/USDSE60 15-24 / AE 50 25-34整數美元
Quantity / UOM (1-3)M...Tariff.Quantity1-3/UnitOfMeasure1-3AE 50 36-50…UOM 須與 HTS 完全相符
SPI (Trade Agreement)OGetSpecialProgramClaimCode(article)AE 40 25-26S/S+ USMCA、A GSP…
Charges(article 運費)OShipmentArticle.ArticleChargeUSD(「Charge USD」)LDS invoice 精靈表頭的 「Charges」欄——article 的運費(USD)。以「Charge」欄 / Wizard article 欄呈現。同區另補:Foreign port of lading、Manufacturer。可編輯(ACE-7525):依 LDS spec ShipmentArticle.ArticleChargeUSD 為可設定的 [DataMember],故 augmentConfig/makeFieldEditable 清掉誤標的 readOnly,欄位可編輯並於 Save round-trip。顯示於 article Values 分頁的 Charges group 與 lines 表的「Charge」欄。Shipment 層的 ChargeUSD[NotMapped] server rollup(底層 invoices 加總),維持 read-only / 不呈現。

5.6 Duty / Tax / Fee(皆 server 計算,唯讀 / AE 50,60,62,88-90)

UI 欄位LDS 物件.屬性(NotMapped 唯讀)CBP record.field說明
Duty AmountCustomsEntry.DutyAmountAE 50 14-23 / 90關稅
MPFMerchandiseProcessingFeeAE 62 class 499 / 89商品處理費(有 min/max)
HMFHarborMaintenanceFeeAE 62 class 501 / 89港口維護費
IR-TaxInternalRevenueTaxAmountAE 60(016/017/018/022)菸酒等;不可上月結 statement
AD / CVD(Type 03 用)AntiDumping/CountervailingDutyAmountAE 53 / 88本型別 01 不含,03 才有
Total Amount DueCustomsEntry.TotalAmountDue/EntryTotalUSDAE 90 Grand Totals應付總額

5.7 Payment / Statement(CustomsEntry / AE 10 51-61)

UI 欄位必填LDS 物件.屬性CBP record.field說明
Payment TypeMCustomsEntry.PaymentType(預設1)AE 10 pos511 個別 / 2,3,5 日結 / 6,7,8 月結
Preliminary Statement Print DateCPreliminaryStatementPrintDateAE 10 52-57日結/月結必填,未來≤90天非假日
Periodic Statement MonthCPreliminaryStatementMonthDateAE 10 58-59月結必填

6. LDS API Spec Mapping(生命週期方法序列)

Type 01 happy path 的 LDS API 呼叫順序:

#UI 動作LDS API(exact)回傳 / 狀態
0登入 / 連線ClientContext.InitializeContext(url,"user@db",pwd)GetManager<ICustomsEntryManager>()ServicesFactory session
1New EntrymngrCE.New(null)CustomsEntry(預設 01/9/1)
2產生 Entry NoCalculateEntryNumber(number,filerCode,true,true)8 碼含 check digit
3填 header/parties/bond/shipment/invoice/lines設定 CustomsEntryShipments/Invoices/Articles/Tariffs物件樹
4儲存mngrCE.Save(entity)Id 0→SQL;輕量驗證;丟 EntryValidationFault
5計稅(compute-only)CalculateDutyAndFee(id)稅費(NotMapped 唯讀);僅在回傳 totals 時才標為完成 —— 無 result 的 200 / 422 為 FAILED calc(ACE-7491/7531)。每次查詢記入 Query log(ACE-7534)
6驗證(依 application 拆兩顆)ValidateTreeById(id,"QUE AE") 另外 ("QUE SE")兩顆按鈕 → 兩個 result block;失敗丟 EntryValidationFault.EntryValidationErrors空 action 不對應 edit-set 而假 pass,故用 per-app "QUE …" action(ACE-7531)。每次查詢(含失敗的 CBP edit 清單與修復方式)記入 Query log(ACE-7534)
7傳輸(🛠 Tools,二次把關)PutToQUEOneWay(id, ActionQUE.<member>) —— <member> 為完整動作集任一成員(見下方「Transmit 動作集」表)建立 outgoing ABITransmission;以 window.confirm + 後端 confirm:true 把關(ACE-7524/7530/7533)
8取回覆IABITransmissionManager.GetBySourceLink("CustomsEntry={id}",true) / GetAnswers(reqId)incoming ABITransmission(含 CATAIR 原文)
9讀狀態CustomsEntry.LastStatuses(EntityLastStatus)Sent→Incoming→Accepted / CargoReleased / Rejected
10放行查詢ISmsABIManager.PutToQueue_..._Entry(filer,entryNo,true)Release status query
非同步錯誤處理:PutToQUEOneWay 為 OneWay 不丟例外。若 LastStatuses.Status(ABIAppQUE).Value == ABIAppPutToQUEError,其 Text 內含序列化的 EntryValidationFault,以 Serializator.ReadObjectDataContract<FaultException<EntryValidationFault>>(text) 反序列化取得錯誤明細。

6.1 Query log — Duty & Fee 查詢記錄(ACE-7534)

Duty & Fee 節點原本只有 Calculate 的 attempt log;現一般化為統一的 Query log 卡片,記錄該 entry 在此節點發起的每一次查詢。涵蓋三種查詢 op,皆與 CBP/SMS 互動:

OpLDS API / action說明
Calculate duty & feeCalculateDutyAndFee(id)compute-only;回傳 totals 才 PASSED,否則 FAILED
Validate Entry SummaryValidateTreeById(id,"QUE AE")跑 AE/7501 CBP edit-set
Validate Cargo ReleaseValidateTreeById(id,"QUE SE")跑 SE/3461 CBP edit-set

每次查詢在 Query log 由新到舊新增一筆,每筆含下列欄位:

欄位內容
op查詢類型 — Calculate duty & fee / Validate Entry Summary / Validate Cargo Release
statusPASSED / FAILED chip
時間查詢發起時間戳
reason詳細原因(成功:totals / edit-set 通過;失敗:摘要本次為何被拒)
CBP edit 清單(失敗才有)逐筆 欄位 — 訊息 [code](來自 EntryValidationFault.EntryValidationErrors);可點擊跳回欄位
remediation(「Fix:」)(失敗才有)依 code 給出的具體修復指引(見下表)

失敗的紀錄除 CBP edit 清單外,另顯示「Fix:」修復方式。已知 CBP/ABI SMS edit code 對應具體指引:

Edit code意義Fix(修復方式)
6083HTS 對 entry duty date 不 active到該行 Tariff 選一個對此 duty date 有效的 HTS code
6127缺值 / 超出範圍補上 cited 欄位的值、Save、重新驗證
6048state-dependent transmit reject確認此次為 Add vs Replace(該文件之前是否已送出)、是否仍在等待 CBP 上一次回應;依狀態改用對應傳輸動作後重送
其他 / 通用未列舉的 edit code列出 cited 欄位並指引「到 Main Info 修正 → Save → 重新驗證」
Calculate 失敗無 result 的 200 / 422確認 entry 有 shipment → invoice → article → tariff 且每行有 HTS code 與應稅金額並已 Save,再重新計算
Query log 與 05_LDS_Field_API_Mapping 的欄位對應一致;失敗列的 CBP edit 來源為 EntryValidationFault.EntryValidationErrors(每筆含 cited 欄位、訊息、SMS error code)。實作見 Type01_Customs_Portal.html 的 Duty & Fee 節點。

Transmit 動作集 — 🛠 Tools ▸ Transmit to CBP(ActionQUE,依 ABI application 分組,ACE-7533)

權威來源:LDS SMS API spec doc 03「Customs entry classes and interfaces. Part 1」p11 + doc 08「Annex. ABI classes and interfaces」pp5-6 的 ABI app-id → CustomsEntry.ActionQUE 對照矩陣。每個 UI 動作的 action 字串原樣帶到 wire 上的 ActionQUE enum body(no allow-list);每個動作皆 window.confirm + 後端 confirm:true 二次把關。

ApplicationUI 動作CustomsEntry.ActionQUE enum 成員
Entry Summary · AE(CBP 7501)AddAddEntrySummary
ReplaceReplaceEntrySummary
DeleteDeleteEntrySummary
Cargo Release · SE(CBP 3461)AddAddCargoRelease
ReplaceReplaceCargoRelease
CancelCancelCargoRelease
Update Bill of Lading & manifestBOLUpdate
Entry Summary + Cargo ReleaseAdd 兩者AddEntrySummaryAndCargoRelease
Replace 兩者ReplaceEntrySummaryAndCargoRelease
Other ABI actionsACH updateACHUpdate
Extend Temporary Importation BondTemporaryImportationBondExtend
Close Temporary Importation BondTemporaryImportationBondClose
Query Entry Summary statusEntrySummaryQuery
範圍外(ACE-7533,不在 Transmit to CBP 選單):下列 ABI application code 在 spec(doc 08 pp5-6)中沒有 CustomsEntry.ActionQUE enum equivalent,故不放入此動作集,需改走通用 ISmsABIManager.PutToQueue(appId, parameters):CA = PGA Data CorrectionsAP = Paid Entry Summary replace。此外 CW / EW 在 spec 中非 CustomsEntry application code,亦不納入。

6.2 Engineer Debug Log — portal → LDS(SMS Broker)SOAP 紀錄(ACE-7709)

Entry 底部的 log 區由單一卡片改為雙 tab 切換:「User log」(§6.1 的逐欄位 / 逐查詢 edit log)與新增的 「🛠 Engineer Debug」。Engineer Debug tab 列出 portal 對 LDS(SMS Broker)的每一次 SOAP 呼叫,供工程與支援人員直接在 entry 內看 wire 上實際送/收了什麼,不必翻後端 log。實作見 Type01_Customs_Portal.html 的 Duty & Fee 節點 log 區。

權限(暫不綁,gating 為後續)

此 tab 暫不綁任何 user permission —— 所有人可見。初版刻意不做 gating,讓現場除錯零摩擦;權限控管(例如限工程 / admin role、或限非 production 環境)列為後續工作。設計上預留 gating 掛點:tab 是否渲染、以及後端 endpoint 是否回傳,皆為日後可加的單一開關。

Tab UX

記錄內容(每筆 ring-buffer entry)

欄位內容
service.operationSOAP service + operation,例 CustomsEntryManager.CalculateDutyAndFeeTariffManager.FillSpecial99CorrespondTariffs
statusHTTP status(200 / 4xx / 5xx)→ HTTP 2xx / HTTP 5xx / HTTP 4xx;transport 失敗(timeout / connect)→ ERR
時間 · 耗時 ms呼叫發起時間戳與 round-trip 耗時(毫秒)
entry_id歸屬用;以 request path 設定的 entry-id context 標記,供 entry-scope 過濾
request完整 SOAP request envelope(認證已遮罩,見下)
response完整 response payload;transport error 時為 fault / exception 文字

Broker 認證遮罩(永不顯示)

WSSE UsernameToken(username / password)於後端入庫前遮罩 —— 永不寫入 ring buffer,故 UI 永不顯示。遮罩發生在擷取當下(不是顯示時才遮),即使 buffer 內容外洩也不含 broker 認證。其餘 envelope / payload 原樣保留以利除錯。

後端 — read-only endpoint + ring buffer

項目說明
Endpointread-only GET /api/debug/lds-log?entry_id=&limit= —— entry_id 做 entry-scope 過濾(省略則回全部最近);limit 限制回傳筆數
擷取點後端 transport 層旁路(side-channel)擷取每一次 SOAP 呼叫;為旁路、不影響真正呼叫的成敗與時序
儲存process-wide ring buffer(maxlen 300;每筆 payload 設上限以防巨量 envelope 撐爆記憶體);非持久化,process 重啟即清空
遮罩WSSE UsernameToken入庫前遮罩(見上)

涵蓋範圍 — 所有 portal 觸發的 LDS op

擷取涵蓋 portal 觸發的所有 LDS operation,包含:

GetPageGetSaveValidateTreeByIdCalculateDutyAndFeePutToQUEOneWayFillSpecial99CorrespondTariffsGetPreliminaryStatementDates報表
Engineer Debug 與 §6.1 Query log 互補:Query log 從操作員視角記錄 Calculate / Validate 的業務結果與修復指引;Engineer Debug 從工程視角記錄底層每一次 SOAP 呼叫的 wire-level request/response。兩者同列於 entry log 區的雙 tab。

7. CBP 回覆與狀態映射

Cargo Release(SO / SX)— SO60 Disposition

代碼意義看板狀態建議
98RELEASED已放行產生 DO / 提貨
97ADMISSIBLE可受理等放行
03PENDING INTENSIVE EXAM查驗中等 CBP
29NOT RELEASED未放行查原因
96DOCUMENT REQUIRED需文件DIS 上傳
53(SO50)CBP HOLD海關扣留聯繫 CBP
91(SO50)NO BILL MATCH提單未對碰確認 manifest
23 / 88CANCELLED / REPLACED已取消/取代

Entry Summary(AX)— E1 Disposition + Severity

DispSeverity意義看板 / 動作
A(空白)無條件接受Accepted
AWAccepted with Census Warning校正或送 CW02 Override
APAccepted with PGA Warning檢查 PGA
AIAccepted with Info(如可能 AD/CVD)確認
RFRejected / Fatal修正後重送

UC(Entry Summary Status Notification)另回送後事件:4=summary rejected/PSC rejected(2 工作日內回應)、3=request documents、6=canceled、P=PGA、Q=quota 等;reason code 如 003 Classification、005 Line Value、010 AD/CVD Required 等。

8. 業務規則與驗證

規則內容
SE/AE 關聯同一 Entry Number 與 Port of Entry;改 port 須依序:刪 AE → SE「U/R」改 port → 重送 AE,否則 port 不符
放行後限制放行後不再接受 SE「R」;僅 15 日曆日內可 SE「U」更新 bill/manifest/port
HTS 驗證10 碼;Chapter 99 特別關稅須排在 Chapter 1-97 商品 HTS 之前
UOM 一致AE 50 的 UOM 必須與該 HTS 規定完全相符,否則 reject
Census Warning每一筆 warning 都要校正或送出對應 Override(CW02)後 census 才接受
稅費來源金額一律以 CalculateDutyAndFee(server)為準;UI 唯讀,除非啟用 manual override(ManualInputDuty
Statement 限制IR-Tax 行項不可掛月結 statement;Import Specialist 退件且已付款後修正時,statement 欄位不可用
Edit log 標籤(ACE-7496 / ACE-7712)每筆 entry 的 Edit log 對 coded 欄位記錄「標籤」而非原始代碼——例如變更 Bond type 時記為 Continuous → Single Transaction,而非 8 → 9。適用所有 reference 欄位(bond type、entry type、transportation mode、payment type、US state、deferred-tax payment)與靜態 select 欄位。變更偵測仍以原始 code 為準,標籤碰撞不會遮蔽真實變更。
強化(ACE-7712):Edit log 現對所有 reference / company 欄位一律顯示完整 name/title + id(code),不再記裸 id 或裸 code:
  • company / directory 欄位(Designated notify party (4811)、Importer、Consignee、Manufacturer、Carrier、Port…)→ 顯示「Name (code)」,例 PACIFIC TRADING LLC (PACTRAD01);未解析時退回「Name (#id)」「#id」。(原本只記裸 id。)
  • coded reference / select 欄位(Bond type…)→ 顯示「Description (code)」,例 Continuous (8)。(原本只記 label。)
change 偵測仍以 raw id / code 為準,name / label 變動不會誤判。前端 only;edit-log payload schema 不變。
Save 並行 — fresh-token overlay(ACE-7529)編輯模式 Save 時,portal 會另路(out-of-band)重抓最新 entity(不寫 cache,故不重新 seed 表單),並把當前的 row_version / entity_guid 遞迴蓋到編輯值的 entry 及每個以 id 對應到的既有子列(overlayFreshTokens)。新(無 id)列不動,故仍能 INSERT。藉此避免因 row_version 過期導致的 ENTRY_CONCURRENCY_ERROR(「0 rows affected」)—— 即「Bond 步驟存不了 / 還原為 null」那類 bug。成功 Save 後重設 baseline 並使 get-query 失效,讓第二次 Save 用到新 token。

9. Invoice & Article 精靈(Wizard)

目的。一個引導式 modal,一次建立一張商業 Invoice 連同它的 Articles(品項行)與每個 article 的 Tariff(HTS)——對齊 LDS 桌面的「Wizard」按鈕(ce-invoice.html)。解決「我有 HTS / 數量 / 金額,但不知道該填哪裡」的困惑:把每個輸入依序對應到正確欄位。

US-04a Invoice & Article 精靈
身為報關操作員,我要在 shipment 上有一個 Wizard,帶我走完 Invoice 表頭 → 一個或多個 Article(各帶其 HTS tariff)→ 檢視 → 確認,讓我不必先學資料階層就能輸入整張發票。

9.1 流程

Shipment ▸ Wizard → ① Invoice 表頭(No. / Value / Currency)→ ② 新增 Article:Description / COO / Value / MID,各帶一條 Tariff 行 (主 HTS / Qty / UOM) → ③ 檢視 → OK 把整張 Invoice(含 Articles + Tariffs)掛到該 Shipment。可重複建立多張。之後 Save → Calculate Duty & Fee。

9.2 欄位 — 每個輸入填在哪

你手上的資料層級欄位(LDS / API)規則
HTS codeTariffHarmonized Tariff / harmonized_tariff_id只填主 HTS;由 Customer Tariff List 自動帶,否則手動加並附客戶 description
QuantityTariffQuantity 1 + UOM 1 / quantity1unit_of_measure1UOM 必須符合該 HTS 規定的單位
Value(金額)Article → InvoiceArticle Value / article_value;Invoice Value / invoice_value幣別在 invoice;非 USD 自動換算
DescriptionArticledescription客戶 / 商業品名
Country of OriginArticlecountry_of_origin2 碼國別
Manufacturer / MIDArticleManufacturer / MID
FDA Product Code(食品)ArticleFDA Product Code → PGA自動帶出 PGA set
Invoice No. / 幣別Invoiceinvoice_number / invoice_value_currencySeller 在 Shipment 層

9.3 驗收標準

已知限制(sandbox01,2026-06 實測):Calculate Duty & Fee 目前對每一筆有稅則行的 entry 都會失敗——sandbox01 的 SMS 對 CalculateDutyAndFee(Id)CalculateDutyAndFeePreliminary(ce) 兩個計稅 op 都回傳空白 body,即使稅則行完整且仍生效、表頭齊全亦然。此為 SMS 後端/沙盒計稅引擎限制,非 portal 或輸入欄位缺陷,需 LDS 端確認。詳見 Type01_Invoice_Wizard_E2E_Test.html〈為什麼 Calculate 失敗〉。
對應:LDS Shipment.Invoices → ShipmentInvoice.Articles → ShipmentArticleTariff;CBP 7501 line(AE 40/50)+ 3461(SE40/SE60)。操作教學見 Invoice & HTS Line Input Guide

9.4 Special 99-Series Tariffs autofill(ACE-7498)

對齊 LDS 桌面「Autofill Special 99 Tariffs」精靈。針對 entry 上既有的商品 HTS(Chapters 1–97),一鍵自動補上對應的 Chapter 99 稅則行(Section 301 / 貿易救濟),操作員免手動查找。

對應:ICustomsEntryManager.FillSpecial99CorrespondTariffs(ce, out haschanges);Chapter-99 行於 CBPF 7501 須排在 Chapters 1–97 商品 HTS 之前(見 §8 HTS validation)。注意:稅則行的 HTS 是 HarmonizedTariff / HarmonizedTariff_Id;CustomerTariff(「Tariff No.」)是另一個 per-contact 捷徑,並非 HTS 本身。
已知限制(sandbox01,ACE-7501):portal 端已送出正確請求(完整樹 round-trip + 每行帶上解析後的 HarmonizedTariff 物件;COO 不再預設 US),但 sandbox01 的 SMS FillSpecial99CorrespondTariffs 仍回 has_changes=false、即使是 China 原產、301 適用且 Chapter-99 provisions 有效的線項也不新增——與計稅 compute op 在沙盒的行為同源。需 LDS 確認伺服器端此 op 是否在 sandbox01 啟用。替代:用「+ Add tariff line」手動加 Chapter-99 行(AC-W12)。