---
# System prepended metadata

title: 鎖控 新增 api
tags: [鎖控]

---

# 鎖控 新增 api
###### tags:  `鎖控`
依需求鎖控庫存，讓後續訂房可以指定相關鎖控，
新增一筆鎖控 (入進table block_mn、有設定鎖控庫存的話 入 blockinv_mn、block_tr、rminv_tr)，
**在新增鎖控時，block_mn跟blockinv_mn 只會帶新增**
* 後端
新增鎖控庫存時，需要扣房型庫存(入rminv_tr)
1. 檢查 鎖控日期-幾天前釋出 需要>=滾房租日期
2. 檢查房型是否有庫存，update完之後檢查
3. 鎖控日期需大於滾房租日期。


```json=
{
        "prg_id" : "PMS0120010",
        "socket_id" : "p6m5HF8u85NACf-0AAAO",
        "athena_id" : 25,
        "ins_usr" : "cio",
        "session_id" : 36729501,
        "func_id" : "0200",
        "params" : {},
        "locale" : "zh_TW",
        "trans_log_id" : "20200227185833585",
        "mac" : "",
        "comp_cod" : "ZZATHENA",
        "hotel_cod" : "01",
        "server_ip" : "",
        "reve_code" : "PMS0120010",
        "client_ip" : "",
        "upd_usr" : "cio",
        "user" : "cio",
        "table" : {
            "block_mn" : [ 
                {
                    "action_cod" : "C",
                    "athena_id" : "25",
                    "hotel_cod" : "01",
                    "block_cod" : "SSS",
                    "block_rmk" : "andy測試專用",
                    "acust_cod" : ""
                }
            ],
            "blockinv_mn" : [
                {
                    "action_cod" : "C",
                    "athena_id" : "25",
                    "hotel_cod" : "01",
                    "block_cod" : "SSS",
                    "room_cod" : "ZZZ",
                    "batch_dat" : "2019/11/11",
                    "block_qnt" : "5",
                    "release_days" : "5"
                },
                {
                    "action_cod" : "C",
                    "athena_id" : "25",
                    "hotel_cod" : "01",
                    "block_cod" : "SSS",
                    "room_cod" : "ZZZ",
                    "batch_dat" : "2019/11/12",
                    "block_qnt" : "5",
                    "release_days" : "5"
                },
                {
                    "action_cod" : "C",
                    "athena_id" : "25",
                    "hotel_cod" : "01",
                    "block_cod" : "SSS",
                    "room_cod" : "ZZZ",
                    "batch_dat" : "2019/11/13",
                    "block_qnt" : "5",
                    "release_days" : "5"
                }
            ]
        },
        "event_time" : "2020-02-27T18:58:31+08:00"
}
```