---
# System prepended metadata

title: 報價單>編輯>暫存

---

# 報價單>編輯>暫存

* 檢查
```
2.3.2	增加檢查ebl_quote.quote_status = 'APPROVED' 時該張報價單不可修改儲存、不送出，則顯示警示訊息: msg.061。
2.4.1	增加檢查若ebl_quote.is_lock = 'Y'，則顯示警示訊息: msg.462。
2.5.7	詢價單號”<>NULL時，檢查更新前當下的ebl_rfq2.lst_upd_date WHERE company_id = ? AND rfq_id = ? AND negotiation_times = ? 和進入報價頁面時的ebl_rfq2.lst_upd_date必須相同才可更新table，否則顯示警示訊息: msg.064。
2.5.8	檢查更新前當下的ebl_quote.lst_upd_date和進入報價頁面時的ebl_quote.lst_upd_date必須相同才可更新table，否則顯示警示訊息: msg.064。
```
* Insert/Update Table

2.5.1	UPDATE ebl_quote，見附表八。
2.5.2	UPDATE ebl_quote_location，見附表九。
2.5.3	INSERT/UPDATE/DELETE ebl_quote_fee_part，
新增計價代碼，執行INSERT，見附表十。
修改計價代碼，執行UPDATE，見附表十。
刪除計價代碼，執行DELETE WHERE company_id = ? AND quote_id = ? AND item = ?。

2.5.4	先DELETE ebl_quote_fee_part_range再INSERT，見附表十一。
2.5.5	INSERT/UPDATE file_archive
新增的檔案INSERT，見附表十二
刪除的檔案UPDATE file_archive WHERE company_id = ? AND file_num = ?，見附表十六

2.5.6	若(ebl_quote.quote_type = 'SPE' AND module = 'EXP') AND (exp_shipment WHERE company_id = ? AND shipment_id = $ebl_quote.shipment_id資料存在)，則INSERT/UPDATE exp_ship_instruction_plan，見附表十四
檢查exp_ship_instruction_plan WHERE company_id = ? AND shipment_id = ? AND flight_no = $ebl_quote.NVL(flight_no, voyage_no) AND lsp_id = $ebl_quote.lsp_id，若資料不存在，則INSERT，否則UPDATE。
若”運次編號”有變更，則舊資料需刪除，DELETE exp_ship_instruction_plan WHERE company_id = ? AND shipment_id = $舊.運次編號 AND quote_id = $ebl_quote.quote_id
若”航班號碼”、”航次”有變更，則舊資料需清空，UPDATE exp_ship_instruction_plan.quote_id = NULL WHERE company_id = ? AND shipment_id = ? AND flight_no = $舊.航班號碼、舊.航次 AND lsp_id = $ebl_quote.lsp_id


* Input
```
// 不包含費用項目、路線、路線.費用
{
    // 基本資料
    basicData: {
        companyId,
        quoteId,
        module
        shipBy,
        seaType,
        area,
        site,
        lspQuoteId,
        oaDays,
        fscSscCharges,
        rfqId,
        quoteType,
        quoteStatus,
        quoteEffectiveDate,
        quoteExpireDate,
        quoteDate,
        quoteWho,
        quoteWhoPhone,
        quoteWhoEmail,
        remark,
        attachment: [
            // 新insert檔案格式長這樣
            {
              "id": 0,
              "fileName": "測試大小.js",
              "key": null,
              "path": "/tmp/WresZsu6nj.js",
              "percent": 100,
              "type": "text/javascript",
              "trackingNo1": null,
              "attType": null,
              "companyId": null,
              "createWho": null,
              "createDate": null,
              "fileNum": null
            },
            // 已經存在的檔案長這樣
            {
                "fileName": "測試大小-61718.js",
                "key": 81068,
                "path": "/opt/toplogis_app/ebilling_file/C0107/ebilling/20230417/測試大小-61718.js",
                "trackingNo1": null,
                "attType": "OTH",
                "companyId": "C0107",
                "createWho": "sourcer",
                "createDate": "2023-04-17T17:16:03Z",
                "fileNum": 81068
            }
        ]
    }
    

    // 新航線與包機才有
    // 運送資訊
    transportInfo: {
        invId,
        poId,
        trackingNo,
        preshipmentId,
        shipmentId,
        shipToId,
        shipToCompany,
        supplierId,
        supplierName,
        carrier,
        flightNo,
        vesselCompany,
        vesselName,
        voyageNo,
        etd,
        eta,
        fromPort,
        toPort,
        hawbId,
        urgentId,
        charter_fee,
        currency,
    }
    
    // 年季度跟其他可以一起儲存
    location: {
        fromLocation,
        fromLocationType,
        toLocation,
        toLocationType,
        fromCountry,
        toCountry,
        fromArea,
        toArea,
        fromCountryPort: ebl_port_group.country_id+port_id,
        toCountryPort: ebl_port_group.country_id+port_id,
        containerYard,
        containerYardType,
        transMode,
        loadingPort,
        dischargePort,
        incoterms,
        forecastWeight,
        forecastWeightUnit,
        forecastWeightRange,
        forecastCtr,
        forecastCtrUnit,
        forecastCtrRange,
        forecastShipments,
        forecastShipmentsRange,
        quoteProcess,
        feeQty,
        feeCodeQty,
        carrier,
        vesselCompany,
        routeType,
        guaranteedSpace,
        boeClosingDate,
        etd,
        eta,
        p2pDays,
        p2dDays,
        remark1,
        remark2,
        remark3,
        quoteId,
        quoteStatus,
    }
    feePart: [
        {
            item,
            isConfirm,
            reject_reason,
            feePartId,
            feeId,
            price_range: {報價級距>級距、收費單位},
            freeTime,
            highSeasonFrom,
            highSeasonTo,
            forecastQtyTot,
            forecastQtyMin,
            forecastQtyMax,
            weightType,
            chargeType,
            remark1,
            remark2,
            remark,
            
        }
    ]
}
```
* Output
```
// 使用 APIResult
{
    success: 0, // 可不用塞
    successMsg: [
        {
            msg: 'msg.017', // 更新成功!
            params: {}
        },
    ],
    fail: 0, // 可不用塞
    failMsg: []
}
```