# 南寶關務系統-ERP資料API串接說明 ## ERP位置 進入裝櫃資料表,右側頁面表格「立案案號」欄位第一筆資料處,其為一按鈕元件。該元件之OnSelcet屬性中,捲動程式至最底部,便會出現呼叫ERP資料API串接程式。   ## 程式碼說明 ```mermaid graph TD A([點選案號]) --> B["包裝參數為JSON\n"] -->|傳入JSON| C[["呼叫'Nanpao_getSalesOrderLists'\n取得顧客訂單資料"]] -->|回傳訂單編號資料| E subgraph 收集訂單明細 E[包裝參數與訂單編號為JSON] -->|傳入JSON| F[["呼叫'Nanpao_getSalesOrderDetailLists'\n取得編號明細資料"]] --> G["存入Collection\n'CustomersItemsListCollection'"] end ``` ```clike= // Call commodity list through APIs //包裝參數為JSON Set( getSalesOrderList_json, JSON( { customerid: varRecord.客戶編號, account: "igateAccount00", password: "igetP@ssw0rdW#e4!Du%" } ) ); //呼叫'Nanpao_getSalesOrderLists'取得顧客訂單資料 Set( DoFlow_getSalesOrderLists, Nanpao_getSalesOrderLists.Run(getSalesOrderList_json) ); //存入Collection'CustomersItemsListCollection' Clear(CustomersItemsListCollection); ForAll( DoFlow_getSalesOrderLists.data As OrderslistforCustomer, Collect( CustomersItemsListCollection, AddColumns( //呼叫'Nanpao_getSalesOrderDetailLists'取得編號明細資料 Nanpao_getSalesOrderDetailLists.Run( //包裝參數與訂單編號為JSON JSON( { customerid: varRecord.客戶編號, orderNo: OrderslistforCustomer.orderNumber, account: "igateAccount00", password: "igetP@ssw0rdW#e4!Du%" } ) ).data, "order_number", OrderslistforCustomer.orderNumber ) ) ); ``` ## Power Automate 工作流程 在PowerApps中,呼叫API需透過呼叫Power Automate 工作流程方式,傳入參數與取得資料。 在本系統中,呼叫ERP資料所使用之工作流程包含'Nanpao_getSalesOrderLists'以及'Nanpao_getSalesOrderDetailLists'。    ### 工作流程結構 ```mermaid graph TD A[PowerApp Initator] -->|傳入JSON| B[[JSON Parser]] -->|傳入參數| C[[HTTP Requester]] -->|回傳資料| E[[Response Receiver]] ``` ### PowerApps Initator 此流程會在從PowerApps中呼叫流程時觸發流程。  ### Json Parser 此流程將傳入JSON解析為下個流程(HTTP Requester)可代入之動態參數。需提供JSON Schema,可點選「Generate from example」,提供範例讓系統生成Schema。  ### HTTP Requester 此流程發出HTTP request,在此帶入API所需參數,包含Method、URL、Headers及body。body部分需撰寫JSON語法,並動態代入由前面流程解析之參數物件。  ### Response Receiver 此流程取得API回傳之資料,解析後傳送回PowerApps中,以供使用PowerApps Fx存取。需提供回傳body之JSON Schema,可點選「Generate from example」,提供範例讓系統生成Schema。  ## Remarks 若API規格更動,需修改兩個部分,包含PowerApps中的Power Apps Fx,以及Power Automate 工作流程中各流程中的資訊。
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up