GoFreight Customs Filing Portal 完成一筆 Type 01 報關的完整規格:使用者故事、流程圖、驗收條件,以及「UI 欄位 → LDS SMS API 物件 → CBP CATAIR record」三層欄位對應。
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」一次送出。
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。因此 UI 必須支援「一筆 Entry 內新增多張 Shipment/Bill」,且計稅、驗證、送件都以整筆 Entry(彙總所有 shipments)為單位。
customs-entry-portal.tsx,navy 主題 scoped 於 customs-portal.css);逐欄位 → API 對照見 05_LDS_Field_API_Mapping。各層級資料物件:CustomsEntry → Shipment → ShipmentInvoice → ShipmentArticle → ShipmentArticleTariff(+ PGA / AdditionalDeclaration / CensusWarning),整棵樹由 ICustomsEntryManager 之 New / Save / Get(include) / CalculateDutyAndFee / ValidateTreeById / PutToQUE 提供;關係人為 Contact(IContactManager,配合 P0 TP Sync)。少數畫面欄位 LDS API 尚無對應(Liquidation、Manifested quantity、Sanctions grid、Invoice 層 party 等),於頁面以紅色標示待 LDS 確認(清單見 05 文件)。
EntityDetail / ENTITY_LAYOUT)Detail pane 依選取的 entity kind 渲染分頁列,每個分頁含一個或多個 field group(2/3/4 欄 form grid),空 group 自動略過。as-built 的 tab → group → field 佈局如下:
| Entity | Tab | Group | 欄位 |
|---|---|---|---|
| Shipment | Bill | Shipment | number, date, transportation_mode, carrier_id, client_ref, booking_number, importer_id, date_of_export, date_of_arrival, date_of_import, description |
| Quantity & In-Bond | quantity, quantity_unit, in_bond_number, in_bond_date | ||
| Master / House bill | is_regular_bill, master_bill_issuer_id, master_bill_number, house_bill_issuer_id, house_bill_number, sub_house_bill_number | ||
| Shipment | Commercial entities | Parties | consignee_id, buyer_id, seller_id, ship_to_id, consolidator_id, stuffing_location_id |
| Invoice | Values | Invoice · Value·Currency·Rate | invoice_number;接著 invoice_value, invoice_mmv, invoice_non_dutiable, invoice_other(各含 value / currency / rate) |
| Commercial entities | Parties | seller_id, ship_to_id | |
| Article | Values | Article · Charges | line_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 entities | Parties | foreign_exporter_id, consignee_id, manufacturer_id | |
| Tariff | Values | Tariff · Values · Quantities | harmonized_tariff_id, tariff_id;tariff_value, tariff_mmv, tariff_non_dutiable, tariff_other;quantity1-3 + unit_of_measure1-3 |
| Payment | Duty & fee | manual_input_duty, duty_amount, duty_rates, user_fee_accounting_class_code, user_fee_amount | |
| FTZ | Privileged foreign status | privileged_foreign_status_harmonized_tariff_id | |
| Sanctions | Sanctions | sanction_disclaim_indicator | |
| P.G.A. | Partner Government Agency | check_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。
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 SE) | SE 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 Calculation) | value Yes → 「Calculated」、No → 「Not calculated」、Error → 「Error」(tooltip 顯示計算錯誤文字)。 |
| Filer | CustomsEntry.EntryFilerCode | — |
| Entry number | CustomsEntry.EntryNumber | — |
| Entry date(預設排序▾) | CustomsEntry.Date | 預設遞減排序 |
| Entry type | CustomsEntry.EntryType | 01/03/11/86… |
| Importer | CustomsEntry.Importer → Contact | — |
| Import date / Arrival date / Release date | DateOfImport / DateOfArrival / DateOfRelease | 關鍵日期群 |
| Client ref | CustomsEntry.ClientRef | — |
| MOT | CustomsEntry.TransportationMode | 運輸方式 |
| Carrier | CustomsEntry.Carrier → Carrier | SCAC |
| Payment type | CustomsEntry.PaymentType | 個別/日結/月結 |
| Responsible | CustomsEntry.ResponsiblePerson → User | 負責人 |
| Id | CustomsEntry.Id | 系統內部 ID |
清單支援欄位排序、列點擊開啟單一 entry、「New Entry」新建(同採 LDS-parity 編輯器)。
採 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 info。Designated 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 通知 |
"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。)01、Bond Type 預設 9、Payment Type 預設 1。NN-NNNNNNNXX / CBP YYDDPP-NNNNN / SSN 三者之一,否則阻擋。Y。9(單筆)時,Surety Code 與 Bond Amount 必填;= 8(連續)時帶連續保證資料;= 0 須提供 Bond Waiver Reason。CustomsEntry.PaymentType / DeferredTaxPayment / PreliminaryStatementPrintDate / PreliminaryStatementMonth(Date)。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 按鈕。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 會報缺。date_of_export(「Export date」)存在於 Shipment entity(DateOfExport)但 manifest 未含;portal 以 augmentConfig 注入 shipments config,使其能渲染且存檔正常 round-trip(亦已加入 manifest JSON,供伺服器端 first-class 支援)。country_of_export)以「COE」欄顯示於 Lines 表與 Invoice Wizard;Invoice 的 Value currency rate(invoice_value_currency_rate)顯示於 invoice 表頭與 Wizard。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,再重新計算)。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:」修復方式。PutToQUEOneWay(id, AddEntrySummaryAndCargoRelease)(或分送 AddEntrySummary / AddCargoRelease),UI 即時顯示「已入列」並記錄 transmission Id 與 SourceLink。GetBySourceLink("CustomsEntry={id}") 與 LastStatuses,把狀態映射到看板:Cargo Release(SO60 代碼)、Entry Summary(AX 的 A/R + severity)、Statement。R/F(Reject/Fatal)時標紅並列出 condition code 與敘述,提供「修正並重送」;回 A/W(Census Warning)時提示需校正或送 Census Warning Override(CW02)。98 RELEASED 時標示貨物已放行;其他(如 29 NOT RELEASED、03 Intensive Exam、53 CBP Hold 等)顯示對應狀態與處理建議。| UI 欄位 | 必填 | LDS 物件.屬性 | CBP record.field | 說明 |
|---|---|---|---|---|
| Entry Number | M | CustomsEntry.EntryNumber(+CalculateEntryNumber()) | SE10 11-18 / AE 10 9-16 | 8 碼含 check digit,自動序號 |
| Filer Code | M | CustomsEntry.EntryFilerCode | SE10 6-8 / AE 10 4-6 | CBP 指派的報關行代碼 |
| Entry Type | M | CustomsEntry.EntryType="01" | SE10 20-21 / AE 10 34-35 | 本型別固定 01 |
| Mode of Transport (MOT) | C | CustomsEntry.TransportationMode | SE10 37-38 / AE 10 36-37 | 10/11 Vessel,40/41 Air,30/31 Truck… |
| Port of Entry | C | CustomsEntry.PortOfEntry(CustomsPort) | SE10 50-54 / AE 10 18-21 | Schedule D;SE/AE 須一致 |
| Port of Unlading | C | CustomsEntry.PortOfUnlading | SE10 56-60 | MOT 50/60/70 必填 |
| Importer of Record (IOR) | M | CustomsEntry.Importer(Contact) | SE10 22-36 / AE 11 3-14 | IRS/CBP/SSN 格式 |
| Estimated Entry Value | M | (由行項彙總) | SE10 40-49 | 整票申報總值(整數美元) |
| Cargo Release Cert. Indicator | C | ActionQUE.AddEntrySummaryAndCargoRelease | AE 10 pos 40 = A | 以 AE 同時驅動放行 |
| Live Entry | O | (送件動作) | AE 10 pos 44 = Y | entry+summary 同送 |
| Consolidated Summary Indicator | C | (多 Shipment 時) | AE 10 pos 42 = Y | 一筆 Entry 併多張提單/放行時設 Y |
| UI 欄位 | 必填 | LDS 物件.屬性 | CBP record.field | 說明 |
|---|---|---|---|---|
| Importer of Record | M | CustomsEntry.Importer | AE 11 IOR Number | 主檔帶入 |
| Consignee | C | Shipment.Consignee | SE30 CN / AE 11 15-26 | header 或 line |
| Manufacturer / Supplier (MID) | C | Shipment.Seller / line party | SE30 MF(+SE35/36) | 含名稱地址;line level 必備 |
| Buyer / Ship To / Consolidator | O | Shipment.Buyer/ShipTo/Consolidator | SE30 BY/ST/CS | 視交易需要 |
| Designated Notify Party (4811) | O | CustomsEntry.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。 |
| UI 欄位 | 必填 | LDS 物件.屬性 | CBP record.field | 說明 |
|---|---|---|---|---|
| Bond Type | M | CustomsEntry.BondType(預設9) | SE10 39 / AE 31 pos3 | 0 無 / 8 連續 / 9 單筆 |
| Surety Company Code | C | CustomsEntry.SuretyCode | SE20 V1 / AE 31 6-8 | Bond Type=9 必填 |
| Bond Amount | C | CustomsEntry.BondAmount | SE20 AMT / AE 31 9-18 | 單筆保證金額 |
| Bond Waiver Reason | C | CustomsEntry.BondWaiverReasonCode | AE 10 62-64 | Bond Type=0 時 |
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 pos5 | Master+House 連送 M 後接 H |
| Master Bill Issuer (SCAC) / No. | M | Shipment.MasterBillIssuer/MasterBillNumber | SE15 6-9 / 10-59 | SCAC + 提單號 |
| House Bill Issuer / No. | C | Shipment.HouseBillIssuer/HouseBillNumber | SE15 (H) | 有 house 時 |
| Carrier / Voyage-Flight | C | CustomsEntry.Carrier/ConveyanceName/TripIdentifier | SE16 | non-AMS bill 必填 |
| Quantity (packages) | M | ShipmentInvoice.Quantity/Unit | SE15 60-67 | 最小包裝單位 |
| Container / Equipment | O | Shipment.Loads(ShipmentLoad) | SE17 | 櫃號 |
| UI 欄位 | 必填 | LDS 物件.屬性 | CBP record.field | 說明 |
|---|---|---|---|---|
| Invoice No / Value / Currency | C | ShipmentInvoice.InvoiceNumber/InvoiceValue/Currency | AE 42 Invoice Ref | 幣別自動換 USD |
| Invoice charges:MMV /Non-dutiable(運費 = 國際運費 + 保險)/ Other | O | ShipmentInvoice.InvoiceMMV / InvoiceNonDutiable / InvoiceOther(各含 *Currency + *CurrencyRate) | value 加項 / 扣項 | MMV = 加項(assists/packing);Non-dutiable = 國際運費 + 保險(「shipping charges」),為扣項;各有自己的 currency + rate |
| Line Identifier | M | ShipmentArticle(line) | SE40 5-7 / AE 40 5-7 | 由 001 起,唯一 |
| Country of Origin (COO) | M | ShipmentArticle.COO | SE40 8-9 / AE 40 9-10 | ISO 2 碼 |
| Commercial Description | M | line description | SE40 11-80 / AE 44 | 商品說明 |
| HTS Number (10-digit) | M | ShipmentArticleTariff.HarmonizedTariff | SE60 5-14 / AE 50 3-12 | Chapter 99 先於 1-97 |
| Line Value | M | ShipmentArticleTariff.TariffValue/USD | SE60 15-24 / AE 50 25-34 | 整數美元 |
| Quantity / UOM (1-3) | M | ...Tariff.Quantity1-3/UnitOfMeasure1-3 | AE 50 36-50… | UOM 須與 HTS 完全相符 |
| SPI (Trade Agreement) | O | GetSpecialProgramClaimCode(article) | AE 40 25-26 | S/S+ USMCA、A GSP… |
| Charges(article 運費) | O | ShipmentArticle.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 / 不呈現。 |
| UI 欄位 | LDS 物件.屬性(NotMapped 唯讀) | CBP record.field | 說明 |
|---|---|---|---|
| Duty Amount | CustomsEntry.DutyAmount | AE 50 14-23 / 90 | 關稅 |
| MPF | MerchandiseProcessingFee | AE 62 class 499 / 89 | 商品處理費(有 min/max) |
| HMF | HarborMaintenanceFee | AE 62 class 501 / 89 | 港口維護費 |
| IR-Tax | InternalRevenueTaxAmount | AE 60(016/017/018/022) | 菸酒等;不可上月結 statement |
| AD / CVD(Type 03 用) | AntiDumping/CountervailingDutyAmount | AE 53 / 88 | 本型別 01 不含,03 才有 |
| Total Amount Due | CustomsEntry.TotalAmountDue/EntryTotalUSD | AE 90 Grand Totals | 應付總額 |
| UI 欄位 | 必填 | LDS 物件.屬性 | CBP record.field | 說明 |
|---|---|---|---|---|
| Payment Type | M | CustomsEntry.PaymentType(預設1) | AE 10 pos51 | 1 個別 / 2,3,5 日結 / 6,7,8 月結 |
| Preliminary Statement Print Date | C | PreliminaryStatementPrintDate | AE 10 52-57 | 日結/月結必填,未來≤90天非假日 |
| Periodic Statement Month | C | PreliminaryStatementMonthDate | AE 10 58-59 | 月結必填 |
Type 01 happy path 的 LDS API 呼叫順序:
| # | UI 動作 | LDS API(exact) | 回傳 / 狀態 |
|---|---|---|---|
| 0 | 登入 / 連線 | ClientContext.InitializeContext(url,"user@db",pwd) → GetManager<ICustomsEntryManager>() | ServicesFactory session |
| 1 | New Entry | mngrCE.New(null) | CustomsEntry(預設 01/9/1) |
| 2 | 產生 Entry No | CalculateEntryNumber(number,filerCode,true,true) | 8 碼含 check digit |
| 3 | 填 header/parties/bond/shipment/invoice/lines | 設定 CustomsEntry 與 Shipments/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) 反序列化取得錯誤明細。
Duty & Fee 節點原本只有 Calculate 的 attempt log;現一般化為統一的 Query log 卡片,記錄該 entry 在此節點發起的每一次查詢。涵蓋三種查詢 op,皆與 CBP/SMS 互動:
| Op | LDS API / action | 說明 |
|---|---|---|
| Calculate duty & fee | CalculateDutyAndFee(id) | compute-only;回傳 totals 才 PASSED,否則 FAILED |
| Validate Entry Summary | ValidateTreeById(id,"QUE AE") | 跑 AE/7501 CBP edit-set |
| Validate Cargo Release | ValidateTreeById(id,"QUE SE") | 跑 SE/3461 CBP edit-set |
每次查詢在 Query log 由新到舊新增一筆,每筆含下列欄位:
| 欄位 | 內容 |
|---|---|
| op | 查詢類型 — Calculate duty & fee / Validate Entry Summary / Validate Cargo Release |
| status | PASSED / 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(修復方式) |
|---|---|---|
| 6083 | HTS 對 entry duty date 不 active | 到該行 Tariff 選一個對此 duty date 有效的 HTS code |
| 6127 | 缺值 / 超出範圍 | 補上 cited 欄位的值、Save、重新驗證 |
| 6048 | state-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,再重新計算 |
05_LDS_Field_API_Mapping 的欄位對應一致;失敗列的 CBP edit 來源為 EntryValidationFault.EntryValidationErrors(每筆含 cited 欄位、訊息、SMS error code)。實作見 Type01_Customs_Portal.html 的 Duty & Fee 節點。權威來源: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 二次把關。
| Application | UI 動作 | CustomsEntry.ActionQUE enum 成員 |
|---|---|---|
| Entry Summary · AE(CBP 7501) | Add | AddEntrySummary |
| Replace | ReplaceEntrySummary | |
| Delete | DeleteEntrySummary | |
| Cargo Release · SE(CBP 3461) | Add | AddCargoRelease |
| Replace | ReplaceCargoRelease | |
| Cancel | CancelCargoRelease | |
| Update Bill of Lading & manifest | BOLUpdate | |
| Entry Summary + Cargo Release | Add 兩者 | AddEntrySummaryAndCargoRelease |
| Replace 兩者 | ReplaceEntrySummaryAndCargoRelease | |
| Other ABI actions | ACH update | ACHUpdate |
| Extend Temporary Importation Bond | TemporaryImportationBondExtend | |
| Close Temporary Importation Bond | TemporaryImportationBondClose | |
| Query Entry Summary status | EntrySummaryQuery |
CustomsEntry.ActionQUE enum equivalent,故不放入此動作集,需改走通用 ISmsABIManager.PutToQueue(appId, parameters):CA = PGA Data Corrections、AP = Paid Entry Summary replace。此外 CW / EW 在 spec 中非 CustomsEntry application code,亦不納入。
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 區。
HTTP {status} / ERR · {transport error})· service.operation(例 CustomsEntryManager.CalculateDutyAndFee)· 時間 · 耗時 ms。| 欄位 | 內容 |
|---|---|
| service.operation | SOAP service + operation,例 CustomsEntryManager.CalculateDutyAndFee、TariffManager.FillSpecial99CorrespondTariffs |
| status | HTTP 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 文字 |
UsernameToken(username / password)於後端入庫前遮罩 —— 永不寫入 ring buffer,故 UI 永不顯示。遮罩發生在擷取當下(不是顯示時才遮),即使 buffer 內容外洩也不含 broker 認證。其餘 envelope / payload 原樣保留以利除錯。| 項目 | 說明 |
|---|---|
| Endpoint | read-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 operation,包含:
| 代碼 | 意義 | 看板狀態 | 建議 |
|---|---|---|---|
| 98 | RELEASED | 已放行 | 產生 DO / 提貨 |
| 97 | ADMISSIBLE | 可受理 | 等放行 |
| 03 | PENDING INTENSIVE EXAM | 查驗中 | 等 CBP |
| 29 | NOT RELEASED | 未放行 | 查原因 |
| 96 | DOCUMENT REQUIRED | 需文件 | DIS 上傳 |
| 53(SO50) | CBP HOLD | 海關扣留 | 聯繫 CBP |
| 91(SO50) | NO BILL MATCH | 提單未對碰 | 確認 manifest |
| 23 / 88 | CANCELLED / REPLACED | 已取消/取代 | — |
| Disp | Severity | 意義 | 看板 / 動作 |
|---|---|---|---|
| A | (空白) | 無條件接受 | Accepted |
| A | W | Accepted with Census Warning | 校正或送 CW02 Override |
| A | P | Accepted with PGA Warning | 檢查 PGA |
| A | I | Accepted with Info(如可能 AD/CVD) | 確認 |
| R | F | Rejected / 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 等。
| 規則 | 內容 |
|---|---|
| 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:
|
| 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。 |
目的。一個引導式 modal,一次建立一張商業 Invoice 連同它的 Articles(品項行)與每個 article 的 Tariff(HTS)——對齊 LDS 桌面的「Wizard」按鈕(ce-invoice.html)。解決「我有 HTS / 數量 / 金額,但不知道該填哪裡」的困惑:把每個輸入依序對應到正確欄位。
| 你手上的資料 | 層級 | 欄位(LDS / API) | 規則 |
|---|---|---|---|
| HTS code | Tariff | Harmonized Tariff / harmonized_tariff_id | 只填主 HTS;由 Customer Tariff List 自動帶,否則手動加並附客戶 description |
| Quantity | Tariff | Quantity 1 + UOM 1 / quantity1、unit_of_measure1 | UOM 必須符合該 HTS 規定的單位 |
| Value(金額) | Article → Invoice | Article Value / article_value;Invoice Value / invoice_value | 幣別在 invoice;非 USD 自動換算 |
| Description | Article | description | 客戶 / 商業品名 |
| Country of Origin | Article | country_of_origin | 2 碼國別 |
| Manufacturer / MID | Article | Manufacturer / MID | — |
| FDA Product Code(食品) | Article | FDA Product Code → PGA | 自動帶出 PGA set |
| Invoice No. / 幣別 | Invoice | invoice_number / invoice_value_currency | Seller 在 Shipment 層 |
unit1)帶出該行的 UOM(Unit of Measure 1),使用者免手動查找(例:6109100012→DOZ、5211202940→M2),仍可手動覆寫。(ACE-7494)US / United);新 article 的 Country of Origin 預設 US。Wizard 以外的其他參照欄位仍維持原生下拉。(ACE-7495)tariff_id),使線項在 LDS 桌面正確顯示(LDS 以 Tariff No. 為線項主鍵)。解析方式 = entry 的 importer(importer_id)+ HTS code;找到 → 設 tariff_id,找不到 → 留 null。Wizard 與 Invoice & Lines 表皆適用。(ACE-7499)tariffs[0])。(ACE-7500)CalculateDutyAndFee(Id) 與 CalculateDutyAndFeePreliminary(ce) 兩個計稅 op 都回傳空白 body,即使稅則行完整且仍生效、表頭齊全亦然。此為 SMS 後端/沙盒計稅引擎限制,非 portal 或輸入欄位缺陷,需 LDS 端確認。詳見 Type01_Invoice_Wizard_E2E_Test.html〈為什麼 Calculate 失敗〉。Shipment.Invoices → ShipmentInvoice.Articles → ShipmentArticleTariff;CBP 7501 line(AE 40/50)+ 3461(SE40/SE60)。操作教學見 Invoice & HTS Line Input Guide。對齊 LDS 桌面「Autofill Special 99 Tariffs」精靈。針對 entry 上既有的商品 HTS(Chapters 1–97),一鍵自動補上對應的 Chapter 99 稅則行(Section 301 / 貿易救濟),操作員免手動查找。
FillSpecial99CorrespondTariffs(ce)(後端 POST /{id}/fill-special99-tariffs),回 {has_changes, entry},不落地。has_changes 時把回傳 entity 帶回表單(新增的 Chapter-99 行可見)並啟用 Save;操作員檢視後 Save 落地(新列存檔時取得 Line ordinal)。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 本身。FillSpecial99CorrespondTariffs 仍回 has_changes=false、即使是 China 原產、301 適用且 Chapter-99 provisions 有效的線項也不新增——與計稅 compute op 在沙盒的行為同源。需 LDS 確認伺服器端此 op 是否在 sandbox01 啟用。替代:用「+ Add tariff line」手動加 Chapter-99 行(AC-W12)。