---
# System prepended metadata

title: 鎖控 修改 api
tags: [鎖控]

---

# 鎖控 修改 api
###### tags:  `鎖控`
在修改鎖控時，block_mn 只能修改、blockinv_mn 會新、刪、修
* 後端
* #### 修改 block_mn
1. 檢查acust_cod，有訂房卡指定此鎖控時不可修改
2. 鎖控日期需大於滾房租日期。
* #### 新增 blockinv_mn
1. 檢查 鎖控日期-幾天前釋出需 >=滾房租日期
2. 鎖控日期需大於滾房租日期。
3. 檢查房型是否有庫存，update完之後檢查

* #### 修改 blockinv_mn
1. 檢查 鎖控日期-幾天前釋出需 >=滾房租日期
2. 鎖控日期需大於滾房租日期。
3. 檢查房型是否有庫存，update完之後檢查
4. 檢查鎖控庫存數量，update完之後檢查
* #### 刪除 blockinv_mn
1. 大於等於滾房租日期，
2. 且沒有任一訂房數及未用釋出的blockinv_mn資料才可刪除
* 前端
1. block_cod 唯讀
2. acust_cod 有訂房卡指定此鎖控時，唯讀
3. room_cod 唯讀
4. batch_dat 唯讀
5. 鎖控日期小於等於滾房租日期，整筆唯讀不可修改、刪除。
6. 只要有 release_days 整筆唯讀不可修改、刪除
7. 修改鎖控數量不可小於訂房數+未用釋出
8. 大於等於滾房租日期，且沒有任一訂房數及未用釋出的blockinv_mn資料才可刪除

```json=
{
        "prg_id" : "PMS0120010",
        "socket_id" : "p6m5HF8u85NACf-0AAAO",
        "athena_id" : 25,
        "ins_usr" : "cio",
        "session_id" : 36729501,
        "func_id" : "0400",
        "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" : "U",
                    "block_rmk" : "andy測試專用-1",
                    "acust_cod" : "TW01",
                    "condition" : [ 
                        {
                            "field" : "athena_id",
                            "value" : "25",
                            "operator" : "equal"
                        }, 
                        {
                            "field" : "hotel_cod",
                            "value" : "01",
                            "operator" : "equal"
                        }, 
                        {
                            "field" : "block_cod",
                            "value" : "SSS",
                            "operator" : "equal"
                        }
                    ]
                }
            ],
            "blockinv_mn" : [
                {
                    "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" : "D",
                    "condition" : [ 
                        {
                            "field" : "athena_id",
                            "value" : "25",
                            "operator" : "equal"
                        }, 
                        {
                            "field" : "hotel_cod",
                            "value" : "01",
                            "operator" : "equal"
                        }, 
                        {
                            "field" : "block_cod",
                            "value" : "SSS",
                            "operator" : "equal"
                        }, 
                        {
                            "field" : "batch_dat",
                            "value" : "2019/11/11",
                            "operator" : "equal"
                        }, 
                        {
                            "field" : "room_cod",
                            "value" : "ZZZ",
                            "operator" : "equal"
                        }
                    ]
                }
            ]
        },
        "event_time" : "2020-02-27T18:58:31+08:00"
}
```