01-db.rst.txt 20.8 KB
数据库设计
=======================

销售合同表
++++++++++++

   表名: tb_contract

   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   |  字段名称             |  是否必填   |  类型     |  限制     |  唯一   |  说明                    |
   +=======================+=============+===========+===========+=========+==========================+
   | contract_code         | *是*        | string    |   <=32    |  是     | 合同编号(主键),通过   |
   |                       |             |           |           |         | code服务进行选择         |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | salesperson_unid      | *是*        | string    |   <=32    |  否     | 销售员,通过code服       |
   |                       |             |           |           |         | 务进行选择               |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | project_unid          | *是*        | string    |   <=32    |  否     | 项目名称,通过code服务   |
   |                       |             |           |           |         | 进行选择                 |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | customer_unid         | *是*        | string    |   <=32    |  否     | 客户名称,通过code服务   |
   |                       |             |           |           |         | 进行选择                 |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | location_province     | *是*        | string    |   <=32    |  否     | 项目所在地的省份         |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | location_city         | *是*        | string    |   <=32    |  否     | 项目所在地的市           |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | location_area         | *是*        | string    |   <=32    |  否     | 项目所在地的县(区)     |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | quality_cycle         | *是*        | int       |   <=16    |  否     | 质保周期,通过code服务进 |
   |                       |             |           |           |         | 行选择                   |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | sign_date             | *是*        | date      |   <=16    |  否     | 签订时间                 |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | year                  | *是*        | string    |   <=4     |  否     | 所属年份                 |          
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | month                 | *是*        | string    |   <=2     |  否     | 所属月份                 |              
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | product_line_type     | *是*        | string    |   <=32    |  否     | 产品线类型,通过code服务 |
   |                       |             |           |           |         | 进行选择                 |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | contract_state        | *是*        | string    |   <=32    |  否     | 合同状态,通过code服务进 |
   |                       |             |           |           |         | 行选择                   |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | contract_nature       | *是*        | string    |   <=32    |  否     | 合同性质,通过code服务进 |
   |                       |             |           |           |         | 行选择                   |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | contract_amount       | *是*        | float     |   <=24    |  否     | 合同金额                 |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | deduct_amount         | *是*        | float     |   <=24    |  否     | 抵扣金额                 |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | contract_amount_note  | *否*        | text      |           |  否     | 合同金额备注             |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | total_reback_amount   | *是*        | float     |   <=24    |  否     | 累计回款额               |          
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | stop_amount           | *是*        | float     |   <=24    |  否     | 暂停金额                 |              
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | reback_note           | *否*        | text      |           |  否     | 累计回款额备注           |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | contract_remaining    | *是*        | float     |   <=24    |  否     | 合同余额                 |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | exemptions_amount     | *是*        | float     |   <=24    |  否     | 豁免金额                 |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | contract_remain_note  | *否*        | text      |           |  否     | 合同余额备注             |          
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | is_file               | *是*        | bool      |           |  否     | 是否归档,通过code服务进 |
   |                       |             |           |           |         | 行选择                   |              
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | bad_amount            | *是*        | float     |   <=24    |  否     | 坏账金额                 |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | bad_amount_note       | *否*        | text      |           |  否     | 坏账金额备注             |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | total_receive_amount  | *是*        | float     |   <=24    |  否     | 累计应收款               |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | total_leave_amount    | *是*        | float     |   <=24    |  否     | 应收账款余额             |          
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | over_days_unid        | *是*        | int       |   <=16    |  否     | 逾期天数                 |              
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | confirm_income_amount | *是*        | float     |   <=24    |  否     | 确定收入金额             |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | amount_state_unid     | *是*        | string    |   <=32    |  否     | 账款状态,通过code服务进行|
   |                       |             |           |           |         | 选择                     |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | start_guarantee_date  | *是*        | date      |           |  否     | 维保服务期开始时间       |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | end_guarantee_date    | *是*        | date      |           |  否     | 维保服务期结束时间       |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | quality_start_point   | *是*        | string    |   <=32    |  否     | 质保期开始节点           |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | start_quality_date    | *是*        | date      |           |  否     | 质保期开始时间           |          
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | end_quality_date      | *是*        | date      |           |  否     | 质保期结束时间           |              
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | contract_note         | *否*        | text      |           |  否     | 合同备注                 |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | contract_identify     | *否*        | bool      |           |  否     | 合同标识                 |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+

   
付款约定表
++++++++++++

   表名:tb_payment_agree
   
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   |  字段名称             |  是否必填   |  类型     |  限制     |  唯一   |  说明                    |
   +=======================+=============+===========+===========+=========+==========================+
   | payment_id            | *是*        | string    |   <=32    |  是     | 主键                     |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+ 
   | contract_code         | *是*        | String    |   <=32    |  否     | 合同编号,通过code服务进 |
   |                       |             |           |           |         | 行选择                   |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | payment_period_state  | *是*        | string    |   <=10    |  否     | 合同状态,通过code服务进 |
   |                       |             |           |           |         | 行选择                   |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | total_days            | *是*        | int       |   <=32    |  否     | 天数                     |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | payment_agree_date    | *是*        | date      |           |  否     | 应付款日期               |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | payment_amount        | *是*        | float     |   <=16    |  否     | 应付金额                 |          
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | payment_propority     | *是*        | float     |   <=16    |  否     | 付款比例,通过code服务进 |
   |                       |             |           |           |         | 行选择                   |              
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | payment_requirement   | *是*        | text      |           |  否     | 付款条件                 |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   
   
合同回款信息表
++++++++++++++++++

   表名:tb_return_info
   
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   |  字段名称             |  是否必填   |  类型     |  限制     |  唯一   |  说明                    |
   +=======================+=============+===========+===========+=========+==========================+
   | return_id             | *是*        | string    |   <=32    |  是     | 主键                     |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+ 
   | contract_code         | *是*        | string    |   <=32    |  否     | 合同编号,通过code服务进 |
   |                       |             |           |           |         | 行选择                   |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | reback_date           | *是*        | date      |           |  否     | 回款时间                 |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | actual_reback_amount  | *是*        | float     |   <=24    |  否     | 实际回款数额             |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | reback_propority      | *是*        | float     |   <=24    |  否     | 回款比例                 |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | reback_note           | *否*        | text      |           |  否     | 回款备注                 |          
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   
   
合同开票信息表
+++++++++++++++++++++

   表名:tb_receipt
   
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   |  字段名称             |  是否必填   |  类型     |  限制     |  唯一   |  说明                    |
   +=======================+=============+===========+===========+=========+==========================+
   | receipt_id            | *是*        | string    |   <=32    |  是     | 合同开票信息主键         |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | contract_code         | *是*        | string    |   <=32    |  否     | 合同编号,通过code服务进 |
   |                       |             |           |           |         | 行选择                   |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | receipt_amount        | *是*        | float     |   <=24    |  否     | 开票金额                 |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | oa_flow_id            | *是*        | int       |   <=32    |  否     | oa流水号                 |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | receipt_propority     | *是*        | float     |   <=24    |  否     | 开票比例                 |          
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | total_receipt_amount  | *是*        | float     |   <=24    |  否     | 累计开票金额             |              
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | is_reback             | *否*        | bool      |           |  否     | 是否回款                 |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | receipt_note          | *是*        | text      |           |  否     | 发票备注                 |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   
   
发货信息表
++++++++++++++++

   表名:tb_deliver_goods
   
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   |  字段名称             |  是否必填   |  类型     |  限制     |  唯一   |  说明                    |
   +=======================+=============+===========+===========+=========+==========================+
   | deliver_id            | *是*        | string    |   <=32    |  是     | 发货信息主键             |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | contract_code         | *是*        | string    |   <=32    |  否     | 合同编号,通过code服务进 |
   |                       |             |           |           |         | 行选择                   |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | deliver_goods_date    | *是*        | date      |           |  否     | 发货时间                 |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | goods_check_date      | *是*        | date      |           |  否     | 到货验收时间             |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   
   
工程验收信息表
+++++++++++++++++++

   表名:tb_project_check
   
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   |  字段名称             |  是否必填   |  类型     |  限制     |  唯一   |  说明                    |
   +=======================+=============+===========+===========+=========+==========================+
   | project_id            | *是*        | string    |   <=32    |  是     | 工程验收信息主键         |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | contract_code         | *是*        | string    |   <=32    |  否     | 合同编号,通过code服务进 |
   |                       |             |           |           |         | 行选择                   |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | is_first_check        | *是*        | bool      |           |  否     | 是否是初验               |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | first_check_date      | *是*        | date      |           |  否     | 初验时间                 |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | is_end_check          | *是*        | bool      |           |  否     | 是否是终验               |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | end_check_date        | *否*        | date      |           |  否     | 终验时间                 |          
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | check_note            | *否*        | text      |           |  否     | 验收备注                 |              
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   
   
附件表
++++++++++++

   表名:tb_appendix
   
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   |  字段名称             |  是否必填   |  类型     |  限制     |  唯一   |  说明                    |
   +=======================+=============+===========+===========+=========+==========================+
   | appendix_id           | *是*        | string    |   <=32    |  是     | 附件主键                 |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | foreign_key           | *是*        | string    |           |  是     | 合同及子表的主键         |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | appendix_type         | *是*        | string    |           |  是     | 附件类型                 |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | appendix_url          | *是*        | string    |           |  否     | 附件下载地址             |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+