资产所在竖井
## 前置条件
    1. 资产有绑定的设备或部件
    2. 绑定的设备或部件有所在竖井关系
## 依赖函数
    Eq2Sh
## 计算流程
    根据 资产 --> 设备/部件 --> 竖井 的间接关系, 来获取资产所在竖井的关系
    
## 函数
```
-- 资产所在竖井
create or replace function public.rel_pe2sh(project_id character varying) returns boolean
as
$$
try:
    # 将下面对数据库的操作作为一个事务, 出异常则自动rollback
    with plpy.subtransaction():
        delete_plan = plpy.prepare("delete from r_pe_in_sh where project_id = $1 and sign = 2", ["text"])
        delete_plan.execute([project_id])
        plan = plpy.prepare("insert into r_pe_in_sh(equip_id, shaft_id, project_id, sign) select pe.id, rel.shaft_id, rel.project_id, 2 from property pe inner join r_eq_in_sh rel on pe.equip_id = rel.equip_id where pe.project_id = $1 and rel.project_id = $1", ["text"])
        plan.execute([project_id])
except Exception as e:
    plpy.warning(e)
    return False
else:
    return True
$$
LANGUAGE 'plpython3u' VOLATILE;


select public.rel_pe2sh('Pj1101010015');
```

## 入参
    1. 项目id
## 例子
    select public.rel_pe2sh('Pj1101010015');