IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[tools_classify]') AND type in (N'U')) DROP TABLE [dbo].[tools_classify];
CREATE TABLE [dbo].[tools_classify](
    id VARCHAR(32) NOT NULL,
    classify_id VARCHAR(255),
    type_name VARCHAR(128) NOT NULL,
    parent_id VARCHAR(32) NOT NULL,
    leaf_flag VARCHAR(6),
    seq VARCHAR(255),
    status VARCHAR(6),
    rank INT NOT NULL,
    encoding_type VARCHAR(32),
    para_type_flag VARCHAR(32) NOT NULL,
    remark VARCHAR(128),
    tenant_id ,
    created_by VARCHAR(32),
    created_time DATE,
    updated_by VARCHAR(32),
    updated_time DATE,
    PRIMARY KEY (id)
);

EXEC sp_addextendedproperty 'MS_Description', '工具分类信息表', 'SCHEMA', dbo, 'table', tools_classify, null, null;
EXEC sp_addextendedproperty 'MS_Description', '主键', 'SCHEMA', dbo, 'table', tools_classify, 'column', id;
EXEC sp_addextendedproperty 'MS_Description', '分类编号', 'SCHEMA', dbo, 'table', tools_classify, 'column', classify_id;
EXEC sp_addextendedproperty 'MS_Description', '类型名称', 'SCHEMA', dbo, 'table', tools_classify, 'column', type_name;
EXEC sp_addextendedproperty 'MS_Description', '父类型编号', 'SCHEMA', dbo, 'table', tools_classify, 'column', parent_id;
EXEC sp_addextendedproperty 'MS_Description', '叶子节点标记;1是2否', 'SCHEMA', dbo, 'table', tools_classify, 'column', leaf_flag;
EXEC sp_addextendedproperty 'MS_Description', '显示序号', 'SCHEMA', dbo, 'table', tools_classify, 'column', seq;
EXEC sp_addextendedproperty 'MS_Description', '状态;1.启用；2.关闭', 'SCHEMA', dbo, 'table', tools_classify, 'column', status;
EXEC sp_addextendedproperty 'MS_Description', '层级', 'SCHEMA', dbo, 'table', tools_classify, 'column', rank;
EXEC sp_addextendedproperty 'MS_Description', '工具分类编码方式;1.系统生成；
2.按编码拼接；
3.手工编码', 'SCHEMA', dbo, 'table', tools_classify, 'column', encoding_type;
EXEC sp_addextendedproperty 'MS_Description', '对应参数模板表名称', 'SCHEMA', dbo, 'table', tools_classify, 'column', para_type_flag;
EXEC sp_addextendedproperty 'MS_Description', '备注', 'SCHEMA', dbo, 'table', tools_classify, 'column', remark;
EXEC sp_addextendedproperty 'MS_Description', '租户号', 'SCHEMA', dbo, 'table', tools_classify, 'column', tenant_id;
EXEC sp_addextendedproperty 'MS_Description', '创建人', 'SCHEMA', dbo, 'table', tools_classify, 'column', created_by;
EXEC sp_addextendedproperty 'MS_Description', '创建时间', 'SCHEMA', dbo, 'table', tools_classify, 'column', created_time;
EXEC sp_addextendedproperty 'MS_Description', '更新人', 'SCHEMA', dbo, 'table', tools_classify, 'column', updated_by;
EXEC sp_addextendedproperty 'MS_Description', '更新时间', 'SCHEMA', dbo, 'table', tools_classify, 'column', updated_time;

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[base_tools]') AND type in (N'U')) DROP TABLE [dbo].[base_tools];
CREATE TABLE [dbo].[base_tools](
    id 32(32) NOT NULL,
    classify_id 32(32) NOT NULL,
    tool_code VARCHAR(32) NOT NULL,
    tool_id VARCHAR(32),
    tool_level VARCHAR(16),
    i_count VARCHAR(255),
    sign_code VARCHAR(16),
    chinese_name VARCHAR(128),
    foreign_language_name VARCHAR(128),
    standard_level VARCHAR(16),
    standard_code VARCHAR(32),
    tool_model VARCHAR(255),
    remark VARCHAR(255),
    tenant_id VARCHAR,
    created_by VARCHAR(32),
    created_time DATETIME,
    updated_by VARCHAR(32),
    updated_time DATETIME,
    PRIMARY KEY (id)
);

EXEC sp_addextendedproperty 'MS_Description', '工具信息表', 'SCHEMA', dbo, 'table', base_tools, null, null;
EXEC sp_addextendedproperty 'MS_Description', '主键', 'SCHEMA', dbo, 'table', base_tools, 'column', id;
EXEC sp_addextendedproperty 'MS_Description', '分类编号', 'SCHEMA', dbo, 'table', base_tools, 'column', classify_id;
EXEC sp_addextendedproperty 'MS_Description', '工具编码', 'SCHEMA', dbo, 'table', base_tools, 'column', tool_code;
EXEC sp_addextendedproperty 'MS_Description', '工具编号', 'SCHEMA', dbo, 'table', base_tools, 'column', tool_id;
EXEC sp_addextendedproperty 'MS_Description', '工具等级;工具精确等级分为3个等级：分别为A、B、C
A类:特别重要，入库的工具是要附实物编码（例如:Q20120918011-0001)
B类:一般重要，入库的工具是不附实物编码（例如:Q20120918011)
C类:不重要，没有特殊规定，航宇暂时没有使用场景', 'SCHEMA', dbo, 'table', base_tools, 'column', tool_level;
EXEC sp_addextendedproperty 'MS_Description', '把号最大值', 'SCHEMA', dbo, 'table', base_tools, 'column', i_count;
EXEC sp_addextendedproperty 'MS_Description', '序号（或企业内码)', 'SCHEMA', dbo, 'table', base_tools, 'column', sign_code;
EXEC sp_addextendedproperty 'MS_Description', '中文名称', 'SCHEMA', dbo, 'table', base_tools, 'column', chinese_name;
EXEC sp_addextendedproperty 'MS_Description', '外文名称', 'SCHEMA', dbo, 'table', base_tools, 'column', foreign_language_name;
EXEC sp_addextendedproperty 'MS_Description', '标注级别', 'SCHEMA', dbo, 'table', base_tools, 'column', standard_level;
EXEC sp_addextendedproperty 'MS_Description', '标准号', 'SCHEMA', dbo, 'table', base_tools, 'column', standard_code;
EXEC sp_addextendedproperty 'MS_Description', '型号/图号', 'SCHEMA', dbo, 'table', base_tools, 'column', tool_model;
EXEC sp_addextendedproperty 'MS_Description', '备注', 'SCHEMA', dbo, 'table', base_tools, 'column', remark;
EXEC sp_addextendedproperty 'MS_Description', '租户号', 'SCHEMA', dbo, 'table', base_tools, 'column', tenant_id;
EXEC sp_addextendedproperty 'MS_Description', '创建人', 'SCHEMA', dbo, 'table', base_tools, 'column', created_by;
EXEC sp_addextendedproperty 'MS_Description', '创建时间', 'SCHEMA', dbo, 'table', base_tools, 'column', created_time;
EXEC sp_addextendedproperty 'MS_Description', '更新人', 'SCHEMA', dbo, 'table', base_tools, 'column', updated_by;
EXEC sp_addextendedproperty 'MS_Description', '更新时间', 'SCHEMA', dbo, 'table', base_tools, 'column', updated_time;

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[para_hole_tools]') AND type in (N'U')) DROP TABLE [dbo].[para_hole_tools];
CREATE TABLE [dbo].[para_hole_tools](
    id VARCHAR(32) NOT NULL,
    classify_id VARCHAR(32) NOT NULL,
    tool_code VARCHAR(32) NOT NULL,
    sign_code VARCHAR(16),
    chinese_name VARCHAR(128),
    foreign_language_name VARCHAR(128),
    standard_level VARCHAR(16),
    standard_code VARCHAR(32),
    position_code VARCHAR(255),
    tool_model VARCHAR(255) NOT NULL,
    diameter VARCHAR(128) NOT NULL,
    cone_angle VARCHAR(24),
    edge_length VARCHAR(24) NOT NULL,
    total_length VARCHAR(24) NOT NULL,
    tool_material VARCHAR(64) NOT NULL,
    part_material VARCHAR(64),
    paintcoat_flag VARCHAR(32) NOT NULL,
    tool_pattern VARCHAR(64) NOT NULL,
    handle_specifications VARCHAR(128) NOT NULL,
    cooling_method VARCHAR(64) NOT NULL,
    technical_conditions VARCHAR(128) NOT NULL,
    conditions_info VARCHAR(128),
    brand VARCHAR(64),
    types VARCHAR(64),
    tolerance_class VARCHAR(64),
    flute_form VARCHAR(64),
    handle_form VARCHAR(64),
    blade_count VARCHAR(24),
    small_diameter VARCHAR(16),
    chamfer_angle VARCHAR(16),
    fitter_part VARCHAR(64),
    effective_length VARCHAR(16),
    drill_diameter_range VARCHAR(32),
    knife_diameter VARCHAR(16),
    bore_diameter VARCHAR(16),
    connector_type VARCHAR(16),
    slot_specification VARCHAR(32),
    scope_of_application VARCHAR(32),
    latest_boring_diameter VARCHAR(16),
    max_boring_diameter VARCHAR(16),
    processingmethod VARCHAR(64),
    heads_number VARCHAR(16),
    adapt_holder VARCHAR(64),
    remark VARCHAR(128),
    tenant_id VARCHAR,
    created_by VARCHAR(32),
    created_time DATETIME,
    updated_by VARCHAR(32),
    updated_time DATETIME,
    PRIMARY KEY (id)
);

EXEC sp_addextendedproperty 'MS_Description', '11孔加工刀具g1', 'SCHEMA', dbo, 'table', para_hole_tools, null, null;
EXEC sp_addextendedproperty 'MS_Description', '主键', 'SCHEMA', dbo, 'table', para_hole_tools, 'column', id;
EXEC sp_addextendedproperty 'MS_Description', '工具分类编号', 'SCHEMA', dbo, 'table', para_hole_tools, 'column', classify_id;
EXEC sp_addextendedproperty 'MS_Description', '工具编号-主键', 'SCHEMA', dbo, 'table', para_hole_tools, 'column', tool_code;
EXEC sp_addextendedproperty 'MS_Description', '序号(或企业内原代码)', 'SCHEMA', dbo, 'table', para_hole_tools, 'column', sign_code;
EXEC sp_addextendedproperty 'MS_Description', '中文名称', 'SCHEMA', dbo, 'table', para_hole_tools, 'column', chinese_name;
EXEC sp_addextendedproperty 'MS_Description', '外文名称', 'SCHEMA', dbo, 'table', para_hole_tools, 'column', foreign_language_name;
EXEC sp_addextendedproperty 'MS_Description', '标准级别', 'SCHEMA', dbo, 'table', para_hole_tools, 'column', standard_level;
EXEC sp_addextendedproperty 'MS_Description', '标准号', 'SCHEMA', dbo, 'table', para_hole_tools, 'column', standard_code;
EXEC sp_addextendedproperty 'MS_Description', '库位号（展示时、可以多个拼接）;展示时、可以多个拼接成多个库位号的字符串，进行伪列展示。', 'SCHEMA', dbo, 'table', para_hole_tools, 'column', position_code;
EXEC sp_addextendedproperty 'MS_Description', '型号/图号', 'SCHEMA', dbo, 'table', para_hole_tools, 'column', tool_model;
EXEC sp_addextendedproperty 'MS_Description', '直径', 'SCHEMA', dbo, 'table', para_hole_tools, 'column', diameter;
EXEC sp_addextendedproperty 'MS_Description', '切削刃锥角', 'SCHEMA', dbo, 'table', para_hole_tools, 'column', cone_angle;
EXEC sp_addextendedproperty 'MS_Description', '切削刃长', 'SCHEMA', dbo, 'table', para_hole_tools, 'column', edge_length;
EXEC sp_addextendedproperty 'MS_Description', '刀具总长', 'SCHEMA', dbo, 'table', para_hole_tools, 'column', total_length;
EXEC sp_addextendedproperty 'MS_Description', '刀具材料', 'SCHEMA', dbo, 'table', para_hole_tools, 'column', tool_material;
EXEC sp_addextendedproperty 'MS_Description', '零件材料', 'SCHEMA', dbo, 'table', para_hole_tools, 'column', part_material;
EXEC sp_addextendedproperty 'MS_Description', '是否涂层', 'SCHEMA', dbo, 'table', para_hole_tools, 'column', paintcoat_flag;
EXEC sp_addextendedproperty 'MS_Description', '刀具型式', 'SCHEMA', dbo, 'table', para_hole_tools, 'column', tool_pattern;
EXEC sp_addextendedproperty 'MS_Description', '柄部规格', 'SCHEMA', dbo, 'table', para_hole_tools, 'column', handle_specifications;
EXEC sp_addextendedproperty 'MS_Description', '冷却方式', 'SCHEMA', dbo, 'table', para_hole_tools, 'column', cooling_method;
EXEC sp_addextendedproperty 'MS_Description', '附加技术条件', 'SCHEMA', dbo, 'table', para_hole_tools, 'column', technical_conditions;
EXEC sp_addextendedproperty 'MS_Description', '附加技术条件说明', 'SCHEMA', dbo, 'table', para_hole_tools, 'column', conditions_info;
EXEC sp_addextendedproperty 'MS_Description', '品牌', 'SCHEMA', dbo, 'table', para_hole_tools, 'column', brand;
EXEC sp_addextendedproperty 'MS_Description', '制式', 'SCHEMA', dbo, 'table', para_hole_tools, 'column', types;
EXEC sp_addextendedproperty 'MS_Description', '公差等级', 'SCHEMA', dbo, 'table', para_hole_tools, 'column', tolerance_class;
EXEC sp_addextendedproperty 'MS_Description', '排屑槽形式', 'SCHEMA', dbo, 'table', para_hole_tools, 'column', flute_form;
EXEC sp_addextendedproperty 'MS_Description', '柄部形式', 'SCHEMA', dbo, 'table', para_hole_tools, 'column', handle_form;
EXEC sp_addextendedproperty 'MS_Description', '刃数', 'SCHEMA', dbo, 'table', para_hole_tools, 'column', blade_count;
EXEC sp_addextendedproperty 'MS_Description', '最小直径', 'SCHEMA', dbo, 'table', para_hole_tools, 'column', small_diameter;
EXEC sp_addextendedproperty 'MS_Description', '倒角角度', 'SCHEMA', dbo, 'table', para_hole_tools, 'column', chamfer_angle;
EXEC sp_addextendedproperty 'MS_Description', '适配刀片-刀头-刀杆', 'SCHEMA', dbo, 'table', para_hole_tools, 'column', fitter_part;
EXEC sp_addextendedproperty 'MS_Description', '有效加工长度', 'SCHEMA', dbo, 'table', para_hole_tools, 'column', effective_length;
EXEC sp_addextendedproperty 'MS_Description', '钻头直径范围', 'SCHEMA', dbo, 'table', para_hole_tools, 'column', drill_diameter_range;
EXEC sp_addextendedproperty 'MS_Description', '刀杆直径', 'SCHEMA', dbo, 'table', para_hole_tools, 'column', knife_diameter;
EXEC sp_addextendedproperty 'MS_Description', '孔径', 'SCHEMA', dbo, 'table', para_hole_tools, 'column', bore_diameter;
EXEC sp_addextendedproperty 'MS_Description', '接口形式', 'SCHEMA', dbo, 'table', para_hole_tools, 'column', connector_type;
EXEC sp_addextendedproperty 'MS_Description', '接口槽长规格', 'SCHEMA', dbo, 'table', para_hole_tools, 'column', slot_specification;
EXEC sp_addextendedproperty 'MS_Description', '适用范围', 'SCHEMA', dbo, 'table', para_hole_tools, 'column', scope_of_application;
EXEC sp_addextendedproperty 'MS_Description', '最新镗孔直径', 'SCHEMA', dbo, 'table', para_hole_tools, 'column', latest_boring_diameter;
EXEC sp_addextendedproperty 'MS_Description', '最大镗孔直径', 'SCHEMA', dbo, 'table', para_hole_tools, 'column', max_boring_diameter;
EXEC sp_addextendedproperty 'MS_Description', '加工方式', 'SCHEMA', dbo, 'table', para_hole_tools, 'column', processingmethod;
EXEC sp_addextendedproperty 'MS_Description', '刀头数', 'SCHEMA', dbo, 'table', para_hole_tools, 'column', heads_number;
EXEC sp_addextendedproperty 'MS_Description', '适配刀座', 'SCHEMA', dbo, 'table', para_hole_tools, 'column', adapt_holder;
EXEC sp_addextendedproperty 'MS_Description', '备注', 'SCHEMA', dbo, 'table', para_hole_tools, 'column', remark;
EXEC sp_addextendedproperty 'MS_Description', '租户号', 'SCHEMA', dbo, 'table', para_hole_tools, 'column', tenant_id;
EXEC sp_addextendedproperty 'MS_Description', '创建人', 'SCHEMA', dbo, 'table', para_hole_tools, 'column', created_by;
EXEC sp_addextendedproperty 'MS_Description', '创建时间', 'SCHEMA', dbo, 'table', para_hole_tools, 'column', created_time;
EXEC sp_addextendedproperty 'MS_Description', '更新人', 'SCHEMA', dbo, 'table', para_hole_tools, 'column', updated_by;
EXEC sp_addextendedproperty 'MS_Description', '更新时间', 'SCHEMA', dbo, 'table', para_hole_tools, 'column', updated_time;

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[para_threading_tool]') AND type in (N'U')) DROP TABLE [dbo].[para_threading_tool];
CREATE TABLE [dbo].[para_threading_tool](
    id VARCHAR(32) NOT NULL,
    classify_id VARCHAR(32) NOT NULL,
    tool_code VARCHAR(32) NOT NULL,
    sign_code VARCHAR(16),
    chinese_name VARCHAR(128),
    foreign_language_name VARCHAR(128),
    standard_level VARCHAR(16),
    standard_code VARCHAR(32),
    position_code VARCHAR(255),
    tool_model VARCHAR(255) NOT NULL,
    thread_code VARCHAR(64) NOT NULL,
    pitch VARCHAR(16) NOT NULL,
    rotation_direction VARCHAR(16) NOT NULL,
    tolerancezone_level VARCHAR(16) NOT NULL,
    edge_length VARCHAR(32) NOT NULL,
    total_length VARCHAR(32) NOT NULL,
    tool_material VARCHAR(64) NOT NULL,
    part_material VARCHAR(64),
    paintcoat_flag VARCHAR(32) NOT NULL,
    external_dimensions VARCHAR(64),
    handle_specifications VARCHAR(64) NOT NULL,
    technical_conditions VARCHAR(128) NOT NULL,
    conditions_info VARCHAR(128),
    brand VARCHAR(64),
    types VARCHAR(64),
    screw_hole_type VARCHAR(16),
    cooling_method VARCHAR(64),
    thread_standard VARCHAR(32),
    flute_solt_type VARCHAR(32),
    thread_type VARCHAR(32),
    guiding_size VARCHAR(32),
    connection_aperture VARCHAR(32),
    connecting_keyway VARCHAR(64),
    tenant_id VARCHAR,
    created_by VARCHAR(32),
    created_time DATETIME,
    updated_by VARCHAR(32),
    updated_time DATETIME,
    PRIMARY KEY (id)
);

EXEC sp_addextendedproperty 'MS_Description', '12螺纹刀具g2', 'SCHEMA', dbo, 'table', para_threading_tool, null, null;
EXEC sp_addextendedproperty 'MS_Description', '主键', 'SCHEMA', dbo, 'table', para_threading_tool, 'column', id;
EXEC sp_addextendedproperty 'MS_Description', '工具分类编号', 'SCHEMA', dbo, 'table', para_threading_tool, 'column', classify_id;
EXEC sp_addextendedproperty 'MS_Description', '工具编号', 'SCHEMA', dbo, 'table', para_threading_tool, 'column', tool_code;
EXEC sp_addextendedproperty 'MS_Description', '序号（或企业内原代码）', 'SCHEMA', dbo, 'table', para_threading_tool, 'column', sign_code;
EXEC sp_addextendedproperty 'MS_Description', '中文名称', 'SCHEMA', dbo, 'table', para_threading_tool, 'column', chinese_name;
EXEC sp_addextendedproperty 'MS_Description', '外文名称', 'SCHEMA', dbo, 'table', para_threading_tool, 'column', foreign_language_name;
EXEC sp_addextendedproperty 'MS_Description', '标准级别', 'SCHEMA', dbo, 'table', para_threading_tool, 'column', standard_level;
EXEC sp_addextendedproperty 'MS_Description', '标准号', 'SCHEMA', dbo, 'table', para_threading_tool, 'column', standard_code;
EXEC sp_addextendedproperty 'MS_Description', '库位号;由库区+层+排+列组成，可以是多个库位号以英文点号分割的字符串。', 'SCHEMA', dbo, 'table', para_threading_tool, 'column', position_code;
EXEC sp_addextendedproperty 'MS_Description', '型号/图号', 'SCHEMA', dbo, 'table', para_threading_tool, 'column', tool_model;
EXEC sp_addextendedproperty 'MS_Description', '螺纹代号', 'SCHEMA', dbo, 'table', para_threading_tool, 'column', thread_code;
EXEC sp_addextendedproperty 'MS_Description', '螺距', 'SCHEMA', dbo, 'table', para_threading_tool, 'column', pitch;
EXEC sp_addextendedproperty 'MS_Description', '螺纹旋向', 'SCHEMA', dbo, 'table', para_threading_tool, 'column', rotation_direction;
EXEC sp_addextendedproperty 'MS_Description', '螺纹公差带代号/精度等级', 'SCHEMA', dbo, 'table', para_threading_tool, 'column', tolerancezone_level;
EXEC sp_addextendedproperty 'MS_Description', '切削刃长', 'SCHEMA', dbo, 'table', para_threading_tool, 'column', edge_length;
EXEC sp_addextendedproperty 'MS_Description', '刀具总长', 'SCHEMA', dbo, 'table', para_threading_tool, 'column', total_length;
EXEC sp_addextendedproperty 'MS_Description', '刀具材料', 'SCHEMA', dbo, 'table', para_threading_tool, 'column', tool_material;
EXEC sp_addextendedproperty 'MS_Description', '零件材料', 'SCHEMA', dbo, 'table', para_threading_tool, 'column', part_material;
EXEC sp_addextendedproperty 'MS_Description', '是否涂层', 'SCHEMA', dbo, 'table', para_threading_tool, 'column', paintcoat_flag;
EXEC sp_addextendedproperty 'MS_Description', '外型尺寸', 'SCHEMA', dbo, 'table', para_threading_tool, 'column', external_dimensions;
EXEC sp_addextendedproperty 'MS_Description', '柄部规格', 'SCHEMA', dbo, 'table', para_threading_tool, 'column', handle_specifications;
EXEC sp_addextendedproperty 'MS_Description', '附件技术条件', 'SCHEMA', dbo, 'table', para_threading_tool, 'column', technical_conditions;
EXEC sp_addextendedproperty 'MS_Description', '附件技术条件说明', 'SCHEMA', dbo, 'table', para_threading_tool, 'column', conditions_info;
EXEC sp_addextendedproperty 'MS_Description', '品牌', 'SCHEMA', dbo, 'table', para_threading_tool, 'column', brand;
EXEC sp_addextendedproperty 'MS_Description', '制式', 'SCHEMA', dbo, 'table', para_threading_tool, 'column', types;
EXEC sp_addextendedproperty 'MS_Description', '螺孔类型', 'SCHEMA', dbo, 'table', para_threading_tool, 'column', screw_hole_type;
EXEC sp_addextendedproperty 'MS_Description', '冷却方式', 'SCHEMA', dbo, 'table', para_threading_tool, 'column', cooling_method;
EXEC sp_addextendedproperty 'MS_Description', '螺纹标准', 'SCHEMA', dbo, 'table', para_threading_tool, 'column', thread_standard;
EXEC sp_addextendedproperty 'MS_Description', '排屑槽型', 'SCHEMA', dbo, 'table', para_threading_tool, 'column', flute_solt_type;
EXEC sp_addextendedproperty 'MS_Description', '螺纹类型', 'SCHEMA', dbo, 'table', para_threading_tool, 'column', thread_type;
EXEC sp_addextendedproperty 'MS_Description', '导向尺寸', 'SCHEMA', dbo, 'table', para_threading_tool, 'column', guiding_size;
EXEC sp_addextendedproperty 'MS_Description', '连接孔径', 'SCHEMA', dbo, 'table', para_threading_tool, 'column', connection_aperture;
EXEC sp_addextendedproperty 'MS_Description', '连接键槽', 'SCHEMA', dbo, 'table', para_threading_tool, 'column', connecting_keyway;
EXEC sp_addextendedproperty 'MS_Description', '租户号', 'SCHEMA', dbo, 'table', para_threading_tool, 'column', tenant_id;
EXEC sp_addextendedproperty 'MS_Description', '创建人', 'SCHEMA', dbo, 'table', para_threading_tool, 'column', created_by;
EXEC sp_addextendedproperty 'MS_Description', '创建时间', 'SCHEMA', dbo, 'table', para_threading_tool, 'column', created_time;
EXEC sp_addextendedproperty 'MS_Description', '更新人', 'SCHEMA', dbo, 'table', para_threading_tool, 'column', updated_by;
EXEC sp_addextendedproperty 'MS_Description', '更新时间', 'SCHEMA', dbo, 'table', para_threading_tool, 'column', updated_time;

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[para_mill_tool]') AND type in (N'U')) DROP TABLE [dbo].[para_mill_tool];
CREATE TABLE [dbo].[para_mill_tool](
    id VARCHAR(32) NOT NULL,
    classify_id VARCHAR(32) NOT NULL,
    tool_code VARCHAR(32) NOT NULL,
    sign_code VARCHAR(16),
    chinese_name VARCHAR(128),
    foreign_language_name VARCHAR(128),
    standard_level VARCHAR(32),
    standard_code VARCHAR(32),
    position_code VARCHAR(255),
    tool_model VARCHAR(255) NOT NULL,
    diameter VARCHAR(128) NOT NULL,
    nose_angle_r VARCHAR(64) NOT NULL,
    number_of_teeth VARCHAR(64) NOT NULL,
    edge_length VARCHAR(24) NOT NULL,
    total_length VARCHAR(24) NOT NULL,
    tool_material VARCHAR(64) NOT NULL,
    part_material VARCHAR(64),
    paintcoat_flag VARCHAR(32) NOT NULL,
    tool_pattern VARCHAR(64) NOT NULL,
    clamping_specifications VARCHAR(64) NOT NULL,
    cooling_method VARCHAR(64) NOT NULL,
    technical_conditions VARCHAR(128) NOT NULL,
    conditions_info VARCHAR(128),
    brand VARCHAR(64),
    neck_diameter VARCHAR(64),
    handle_form VARCHAR(64),
    nose_angle_c VARCHAR(32),
    angle_inside_r VARCHAR(32),
    small_diameter VARCHAR(32),
    tool_angle VARCHAR(16),
    handle_length VARCHAR(16),
    main_angle_k VARCHAR(16),
    deepest_depth VARCHAR(16),
    adapt_blade VARCHAR(64),
    handle_neck_form VARCHAR(64),
    handle_neck_length VARCHAR(16),
    size_specifications VARCHAR(16),
    milling_head_form VARCHAR(16),
    overhanging_length VARCHAR(16),
    cutting_edge_form VARCHAR(16),
    number_patterns VARCHAR(16),
    pitch VARCHAR(16),
    recently_diameter VARCHAR(16),
    tenant_id VARCHAR,
    created_by VARCHAR(32),
    created_time DATETIME,
    updated_by VARCHAR(32),
    updated_time DATETIME,
    PRIMARY KEY (id)
);

EXEC sp_addextendedproperty 'MS_Description', '13铣削刀具g3', 'SCHEMA', dbo, 'table', para_mill_tool, null, null;
EXEC sp_addextendedproperty 'MS_Description', '主键', 'SCHEMA', dbo, 'table', para_mill_tool, 'column', id;
EXEC sp_addextendedproperty 'MS_Description', '工具分类编号', 'SCHEMA', dbo, 'table', para_mill_tool, 'column', classify_id;
EXEC sp_addextendedproperty 'MS_Description', '主键-刀具编号', 'SCHEMA', dbo, 'table', para_mill_tool, 'column', tool_code;
EXEC sp_addextendedproperty 'MS_Description', '序号（或企业内原代码）', 'SCHEMA', dbo, 'table', para_mill_tool, 'column', sign_code;
EXEC sp_addextendedproperty 'MS_Description', '中文名称', 'SCHEMA', dbo, 'table', para_mill_tool, 'column', chinese_name;
EXEC sp_addextendedproperty 'MS_Description', '外文名称', 'SCHEMA', dbo, 'table', para_mill_tool, 'column', foreign_language_name;
EXEC sp_addextendedproperty 'MS_Description', '标准级别', 'SCHEMA', dbo, 'table', para_mill_tool, 'column', standard_level;
EXEC sp_addextendedproperty 'MS_Description', '标准号', 'SCHEMA', dbo, 'table', para_mill_tool, 'column', standard_code;
EXEC sp_addextendedproperty 'MS_Description', '库位号;由库区+层+排+列组成，可以是多个库位号以英文点号分割的字符串。', 'SCHEMA', dbo, 'table', para_mill_tool, 'column', position_code;
EXEC sp_addextendedproperty 'MS_Description', '型号/图号', 'SCHEMA', dbo, 'table', para_mill_tool, 'column', tool_model;
EXEC sp_addextendedproperty 'MS_Description', '刀具直径', 'SCHEMA', dbo, 'table', para_mill_tool, 'column', diameter;
EXEC sp_addextendedproperty 'MS_Description', '刀尖角R', 'SCHEMA', dbo, 'table', para_mill_tool, 'column', nose_angle_r;
EXEC sp_addextendedproperty 'MS_Description', '齿数', 'SCHEMA', dbo, 'table', para_mill_tool, 'column', number_of_teeth;
EXEC sp_addextendedproperty 'MS_Description', '切削刃长', 'SCHEMA', dbo, 'table', para_mill_tool, 'column', edge_length;
EXEC sp_addextendedproperty 'MS_Description', '刀具总长', 'SCHEMA', dbo, 'table', para_mill_tool, 'column', total_length;
EXEC sp_addextendedproperty 'MS_Description', '刀具材料', 'SCHEMA', dbo, 'table', para_mill_tool, 'column', tool_material;
EXEC sp_addextendedproperty 'MS_Description', '零件材料', 'SCHEMA', dbo, 'table', para_mill_tool, 'column', part_material;
EXEC sp_addextendedproperty 'MS_Description', '是否涂层', 'SCHEMA', dbo, 'table', para_mill_tool, 'column', paintcoat_flag;
EXEC sp_addextendedproperty 'MS_Description', '刀具型式', 'SCHEMA', dbo, 'table', para_mill_tool, 'column', tool_pattern;
EXEC sp_addextendedproperty 'MS_Description', '装夹规格', 'SCHEMA', dbo, 'table', para_mill_tool, 'column', clamping_specifications;
EXEC sp_addextendedproperty 'MS_Description', '冷却方式', 'SCHEMA', dbo, 'table', para_mill_tool, 'column', cooling_method;
EXEC sp_addextendedproperty 'MS_Description', '附加技术条件', 'SCHEMA', dbo, 'table', para_mill_tool, 'column', technical_conditions;
EXEC sp_addextendedproperty 'MS_Description', '附加技术条件说明', 'SCHEMA', dbo, 'table', para_mill_tool, 'column', conditions_info;
EXEC sp_addextendedproperty 'MS_Description', '品牌', 'SCHEMA', dbo, 'table', para_mill_tool, 'column', brand;
EXEC sp_addextendedproperty 'MS_Description', '颈径', 'SCHEMA', dbo, 'table', para_mill_tool, 'column', neck_diameter;
EXEC sp_addextendedproperty 'MS_Description', '柄部形式', 'SCHEMA', dbo, 'table', para_mill_tool, 'column', handle_form;
EXEC sp_addextendedproperty 'MS_Description', '刀尖角C', 'SCHEMA', dbo, 'table', para_mill_tool, 'column', nose_angle_c;
EXEC sp_addextendedproperty 'MS_Description', '刀尖角内R', 'SCHEMA', dbo, 'table', para_mill_tool, 'column', angle_inside_r;
EXEC sp_addextendedproperty 'MS_Description', '最小直径', 'SCHEMA', dbo, 'table', para_mill_tool, 'column', small_diameter;
EXEC sp_addextendedproperty 'MS_Description', '刀具角度', 'SCHEMA', dbo, 'table', para_mill_tool, 'column', tool_angle;
EXEC sp_addextendedproperty 'MS_Description', '柄长', 'SCHEMA', dbo, 'table', para_mill_tool, 'column', handle_length;
EXEC sp_addextendedproperty 'MS_Description', '主偏角K', 'SCHEMA', dbo, 'table', para_mill_tool, 'column', main_angle_k;
EXEC sp_addextendedproperty 'MS_Description', '最大切深', 'SCHEMA', dbo, 'table', para_mill_tool, 'column', deepest_depth;
EXEC sp_addextendedproperty 'MS_Description', '适配刀片', 'SCHEMA', dbo, 'table', para_mill_tool, 'column', adapt_blade;
EXEC sp_addextendedproperty 'MS_Description', '柄颈形式', 'SCHEMA', dbo, 'table', para_mill_tool, 'column', handle_neck_form;
EXEC sp_addextendedproperty 'MS_Description', '柄颈长度', 'SCHEMA', dbo, 'table', para_mill_tool, 'column', handle_neck_length;
EXEC sp_addextendedproperty 'MS_Description', '接口尺寸规格', 'SCHEMA', dbo, 'table', para_mill_tool, 'column', size_specifications;
EXEC sp_addextendedproperty 'MS_Description', '铣刀头形式', 'SCHEMA', dbo, 'table', para_mill_tool, 'column', milling_head_form;
EXEC sp_addextendedproperty 'MS_Description', '悬伸长度', 'SCHEMA', dbo, 'table', para_mill_tool, 'column', overhanging_length;
EXEC sp_addextendedproperty 'MS_Description', '切削刃形式', 'SCHEMA', dbo, 'table', para_mill_tool, 'column', cutting_edge_form;
EXEC sp_addextendedproperty 'MS_Description', '内外纹数', 'SCHEMA', dbo, 'table', para_mill_tool, 'column', number_patterns;
EXEC sp_addextendedproperty 'MS_Description', '螺距', 'SCHEMA', dbo, 'table', para_mill_tool, 'column', pitch;
EXEC sp_addextendedproperty 'MS_Description', '最近加工直径', 'SCHEMA', dbo, 'table', para_mill_tool, 'column', recently_diameter;
EXEC sp_addextendedproperty 'MS_Description', '租户号', 'SCHEMA', dbo, 'table', para_mill_tool, 'column', tenant_id;
EXEC sp_addextendedproperty 'MS_Description', '创建人', 'SCHEMA', dbo, 'table', para_mill_tool, 'column', created_by;
EXEC sp_addextendedproperty 'MS_Description', '创建时间', 'SCHEMA', dbo, 'table', para_mill_tool, 'column', created_time;
EXEC sp_addextendedproperty 'MS_Description', '更新人', 'SCHEMA', dbo, 'table', para_mill_tool, 'column', updated_by;
EXEC sp_addextendedproperty 'MS_Description', '更新时间', 'SCHEMA', dbo, 'table', para_mill_tool, 'column', updated_time;

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[para_turning_tools]') AND type in (N'U')) DROP TABLE [dbo].[para_turning_tools];
CREATE TABLE [dbo].[para_turning_tools](
    id VARCHAR(32) NOT NULL,
    classify_id VARCHAR(32),
    tool_code VARCHAR(32) NOT NULL,
    sign_code VARCHAR(16),
    chinese_name VARCHAR(128),
    foreign_language_name VARCHAR(128),
    standard_level VARCHAR(16),
    standard_code VARCHAR(32),
    position_code VARCHAR(255),
    tool_model VARCHAR(255),
    head_specifications VARCHAR(32) NOT NULL,
    matching_number VARCHAR(64) NOT NULL,
    lead_angle VARCHAR(32) NOT NULL,
    cross_sectional_size VARCHAR(16) NOT NULL,
    total_length VARCHAR(32) NOT NULL,
    cutting_direction VARCHAR(24) NOT NULL,
    tool_material VARCHAR(64) NOT NULL,
    part_material VARCHAR(64),
    tool_pattern VARCHAR(64) NOT NULL,
    paintcoat_flag VARCHAR(32) NOT NULL,
    technical_conditions VARCHAR(128) NOT NULL,
    conditions_info VARCHAR(128),
    brand VARCHAR(64),
    types VARCHAR(64),
    knife_size VARCHAR(32),
    cooling_method VARCHAR(64),
    holder_category VARCHAR(64),
    tool_diameter VARCHAR(64),
    fastening_form VARCHAR(64),
    boring_bar_diameter VARCHAR(32),
    blade_length VARCHAR(32),
    blade_shape VARCHAR(24),
    blade_posterior VARCHAR(24),
    bar_direction VARCHAR(64),
    blade_height VARCHAR(32),
    blade_wide VARCHAR(24),
    blade_size VARCHAR(32),
    knife_clip_model VARCHAR(64),
    clamping_method VARCHAR(64),
    slot_width VARCHAR(32),
    small_diameter VARCHAR(32),
    max_diameter VARCHAR(32),
    max_depth VARCHAR(32),
    knife_bar_form VARCHAR(64),
    blade_thickness VARCHAR(32),
    min_diameter VARCHAR(32),
    tenant_id VARCHAR,
    created_by VARCHAR(32),
    created_time DATETIME,
    updated_by VARCHAR(32),
    updated_time DATETIME,
    PRIMARY KEY (id,tool_code)
);

EXEC sp_addextendedproperty 'MS_Description', '14车削刀具g4', 'SCHEMA', dbo, 'table', para_turning_tools, null, null;
EXEC sp_addextendedproperty 'MS_Description', '主键', 'SCHEMA', dbo, 'table', para_turning_tools, 'column', id;
EXEC sp_addextendedproperty 'MS_Description', '工具分类编号', 'SCHEMA', dbo, 'table', para_turning_tools, 'column', classify_id;
EXEC sp_addextendedproperty 'MS_Description', '主键-刀具编号', 'SCHEMA', dbo, 'table', para_turning_tools, 'column', tool_code;
EXEC sp_addextendedproperty 'MS_Description', '序号（或企业内原代码）', 'SCHEMA', dbo, 'table', para_turning_tools, 'column', sign_code;
EXEC sp_addextendedproperty 'MS_Description', '中文名称', 'SCHEMA', dbo, 'table', para_turning_tools, 'column', chinese_name;
EXEC sp_addextendedproperty 'MS_Description', '外文名称', 'SCHEMA', dbo, 'table', para_turning_tools, 'column', foreign_language_name;
EXEC sp_addextendedproperty 'MS_Description', '标准级别', 'SCHEMA', dbo, 'table', para_turning_tools, 'column', standard_level;
EXEC sp_addextendedproperty 'MS_Description', '标准号', 'SCHEMA', dbo, 'table', para_turning_tools, 'column', standard_code;
EXEC sp_addextendedproperty 'MS_Description', '库位号;由库区+层+排+列组成，可以是多个库位号以英文点号分割的字符串。', 'SCHEMA', dbo, 'table', para_turning_tools, 'column', position_code;
EXEC sp_addextendedproperty 'MS_Description', '型号/图号', 'SCHEMA', dbo, 'table', para_turning_tools, 'column', tool_model;
EXEC sp_addextendedproperty 'MS_Description', '刀头规格', 'SCHEMA', dbo, 'table', para_turning_tools, 'column', head_specifications;
EXEC sp_addextendedproperty 'MS_Description', '配套刀片号', 'SCHEMA', dbo, 'table', para_turning_tools, 'column', matching_number;
EXEC sp_addextendedproperty 'MS_Description', '主偏角', 'SCHEMA', dbo, 'table', para_turning_tools, 'column', lead_angle;
EXEC sp_addextendedproperty 'MS_Description', '刀具截面尺寸', 'SCHEMA', dbo, 'table', para_turning_tools, 'column', cross_sectional_size;
EXEC sp_addextendedproperty 'MS_Description', '刀具总长', 'SCHEMA', dbo, 'table', para_turning_tools, 'column', total_length;
EXEC sp_addextendedproperty 'MS_Description', '切削方向', 'SCHEMA', dbo, 'table', para_turning_tools, 'column', cutting_direction;
EXEC sp_addextendedproperty 'MS_Description', '刀具材料', 'SCHEMA', dbo, 'table', para_turning_tools, 'column', tool_material;
EXEC sp_addextendedproperty 'MS_Description', '零件材料', 'SCHEMA', dbo, 'table', para_turning_tools, 'column', part_material;
EXEC sp_addextendedproperty 'MS_Description', '刀具型式', 'SCHEMA', dbo, 'table', para_turning_tools, 'column', tool_pattern;
EXEC sp_addextendedproperty 'MS_Description', '是否涂层', 'SCHEMA', dbo, 'table', para_turning_tools, 'column', paintcoat_flag;
EXEC sp_addextendedproperty 'MS_Description', '附加技术条件', 'SCHEMA', dbo, 'table', para_turning_tools, 'column', technical_conditions;
EXEC sp_addextendedproperty 'MS_Description', '附加技术条件说明', 'SCHEMA', dbo, 'table', para_turning_tools, 'column', conditions_info;
EXEC sp_addextendedproperty 'MS_Description', '品牌', 'SCHEMA', dbo, 'table', para_turning_tools, 'column', brand;
EXEC sp_addextendedproperty 'MS_Description', '制式', 'SCHEMA', dbo, 'table', para_turning_tools, 'column', types;
EXEC sp_addextendedproperty 'MS_Description', '刀片尺寸', 'SCHEMA', dbo, 'table', para_turning_tools, 'column', knife_size;
EXEC sp_addextendedproperty 'MS_Description', '冷却方式', 'SCHEMA', dbo, 'table', para_turning_tools, 'column', cooling_method;
EXEC sp_addextendedproperty 'MS_Description', '刀杆类别', 'SCHEMA', dbo, 'table', para_turning_tools, 'column', holder_category;
EXEC sp_addextendedproperty 'MS_Description', '刀具直径', 'SCHEMA', dbo, 'table', para_turning_tools, 'column', tool_diameter;
EXEC sp_addextendedproperty 'MS_Description', '接口紧固形式', 'SCHEMA', dbo, 'table', para_turning_tools, 'column', fastening_form;
EXEC sp_addextendedproperty 'MS_Description', '镗杆直径', 'SCHEMA', dbo, 'table', para_turning_tools, 'column', boring_bar_diameter;
EXEC sp_addextendedproperty 'MS_Description', '刀杆长度', 'SCHEMA', dbo, 'table', para_turning_tools, 'column', blade_length;
EXEC sp_addextendedproperty 'MS_Description', '刀片形状', 'SCHEMA', dbo, 'table', para_turning_tools, 'column', blade_shape;
EXEC sp_addextendedproperty 'MS_Description', '刀片后角', 'SCHEMA', dbo, 'table', para_turning_tools, 'column', blade_posterior;
EXEC sp_addextendedproperty 'MS_Description', '刀杆方向', 'SCHEMA', dbo, 'table', para_turning_tools, 'column', bar_direction;
EXEC sp_addextendedproperty 'MS_Description', '刀杆高度', 'SCHEMA', dbo, 'table', para_turning_tools, 'column', blade_height;
EXEC sp_addextendedproperty 'MS_Description', '刀杆宽度', 'SCHEMA', dbo, 'table', para_turning_tools, 'column', blade_wide;
EXEC sp_addextendedproperty 'MS_Description', '刀杆尺寸', 'SCHEMA', dbo, 'table', para_turning_tools, 'column', blade_size;
EXEC sp_addextendedproperty 'MS_Description', '刀夹型号', 'SCHEMA', dbo, 'table', para_turning_tools, 'column', knife_clip_model;
EXEC sp_addextendedproperty 'MS_Description', '刀片装夹方式', 'SCHEMA', dbo, 'table', para_turning_tools, 'column', clamping_method;
EXEC sp_addextendedproperty 'MS_Description', '刀片槽宽', 'SCHEMA', dbo, 'table', para_turning_tools, 'column', slot_width;
EXEC sp_addextendedproperty 'MS_Description', '最小切入直径', 'SCHEMA', dbo, 'table', para_turning_tools, 'column', small_diameter;
EXEC sp_addextendedproperty 'MS_Description', '最大切入直径', 'SCHEMA', dbo, 'table', para_turning_tools, 'column', max_diameter;
EXEC sp_addextendedproperty 'MS_Description', '最大切槽深度', 'SCHEMA', dbo, 'table', para_turning_tools, 'column', max_depth;
EXEC sp_addextendedproperty 'MS_Description', '刀杆形式', 'SCHEMA', dbo, 'table', para_turning_tools, 'column', knife_bar_form;
EXEC sp_addextendedproperty 'MS_Description', '刀板厚度', 'SCHEMA', dbo, 'table', para_turning_tools, 'column', blade_thickness;
EXEC sp_addextendedproperty 'MS_Description', '最小加工直径', 'SCHEMA', dbo, 'table', para_turning_tools, 'column', min_diameter;
EXEC sp_addextendedproperty 'MS_Description', '租户号', 'SCHEMA', dbo, 'table', para_turning_tools, 'column', tenant_id;
EXEC sp_addextendedproperty 'MS_Description', '创建人', 'SCHEMA', dbo, 'table', para_turning_tools, 'column', created_by;
EXEC sp_addextendedproperty 'MS_Description', '创建时间', 'SCHEMA', dbo, 'table', para_turning_tools, 'column', created_time;
EXEC sp_addextendedproperty 'MS_Description', '更新人', 'SCHEMA', dbo, 'table', para_turning_tools, 'column', updated_by;
EXEC sp_addextendedproperty 'MS_Description', '更新时间', 'SCHEMA', dbo, 'table', para_turning_tools, 'column', updated_time;

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[para_blade]') AND type in (N'U')) DROP TABLE [dbo].[para_blade];
CREATE TABLE [dbo].[para_blade](
    id VARCHAR(32),
    classify_id VARCHAR(32),
    tool_code VARCHAR(32) NOT NULL,
    sign_code VARCHAR(16),
    chinese_name VARCHAR(128),
    foreign_language_name VARCHAR(128),
    standard_level VARCHAR(16),
    standard_code VARCHAR(32),
    position_code VARCHAR(255),
    tool_model VARCHAR(255),
    blade_shape VARCHAR(32) NOT NULL,
    blade_length VARCHAR(24) NOT NULL,
    cutting_edge_count VARCHAR(32) NOT NULL,
    blade_thickness VARCHAR(32) NOT NULL,
    clamping_type VARCHAR(64) NOT NULL,
    nose_angle_r VARCHAR(24) NOT NULL,
    tool_material VARCHAR(64) NOT NULL,
    part_material VARCHAR(64),
    paintcoat_flag VARCHAR(32) NOT NULL,
    technical_conditions VARCHAR(128) NOT NULL,
    conditions_info VARCHAR(128),
    brand VARCHAR(64),
    types VARCHAR(64),
    coating_material VARCHAR(64),
    processing_classify VARCHAR(64),
    blade_posterior VARCHAR(32),
    cutting_direction VARCHAR(32),
    blade_wide VARCHAR(32),
    blade_size VARCHAR(34),
    in_out_thread VARCHAR(32),
    thread_standard VARCHAR(32),
    dental_angle VARCHAR(16),
    pitch VARCHAR(24),
    min_internal_thread VARCHAR(24),
    tenant_id VARCHAR,
    created_by VARCHAR(32),
    created_time DATETIME,
    updated_by VARCHAR(32),
    updated_time DATETIME,
    PRIMARY KEY (tool_code)
);

EXEC sp_addextendedproperty 'MS_Description', '20刀片g9', 'SCHEMA', dbo, 'table', para_blade, null, null;
EXEC sp_addextendedproperty 'MS_Description', '主键', 'SCHEMA', dbo, 'table', para_blade, 'column', id;
EXEC sp_addextendedproperty 'MS_Description', '工具分类编号', 'SCHEMA', dbo, 'table', para_blade, 'column', classify_id;
EXEC sp_addextendedproperty 'MS_Description', '主键-刀具编号', 'SCHEMA', dbo, 'table', para_blade, 'column', tool_code;
EXEC sp_addextendedproperty 'MS_Description', '序号（或企业内原代码）', 'SCHEMA', dbo, 'table', para_blade, 'column', sign_code;
EXEC sp_addextendedproperty 'MS_Description', '中文名称', 'SCHEMA', dbo, 'table', para_blade, 'column', chinese_name;
EXEC sp_addextendedproperty 'MS_Description', '外文名称', 'SCHEMA', dbo, 'table', para_blade, 'column', foreign_language_name;
EXEC sp_addextendedproperty 'MS_Description', '标准级别', 'SCHEMA', dbo, 'table', para_blade, 'column', standard_level;
EXEC sp_addextendedproperty 'MS_Description', '标准号', 'SCHEMA', dbo, 'table', para_blade, 'column', standard_code;
EXEC sp_addextendedproperty 'MS_Description', '库位号;由库区+层+排+列组成，可以是多个库位号以英文点号分割的字符串。', 'SCHEMA', dbo, 'table', para_blade, 'column', position_code;
EXEC sp_addextendedproperty 'MS_Description', '型号/图号', 'SCHEMA', dbo, 'table', para_blade, 'column', tool_model;
EXEC sp_addextendedproperty 'MS_Description', '刀片形状', 'SCHEMA', dbo, 'table', para_blade, 'column', blade_shape;
EXEC sp_addextendedproperty 'MS_Description', '刀片长度', 'SCHEMA', dbo, 'table', para_blade, 'column', blade_length;
EXEC sp_addextendedproperty 'MS_Description', '切削刃数', 'SCHEMA', dbo, 'table', para_blade, 'column', cutting_edge_count;
EXEC sp_addextendedproperty 'MS_Description', '刀片厚度', 'SCHEMA', dbo, 'table', para_blade, 'column', blade_thickness;
EXEC sp_addextendedproperty 'MS_Description', '夹固型式', 'SCHEMA', dbo, 'table', para_blade, 'column', clamping_type;
EXEC sp_addextendedproperty 'MS_Description', '刀尖R', 'SCHEMA', dbo, 'table', para_blade, 'column', nose_angle_r;
EXEC sp_addextendedproperty 'MS_Description', '刀片材料', 'SCHEMA', dbo, 'table', para_blade, 'column', tool_material;
EXEC sp_addextendedproperty 'MS_Description', '零件材料', 'SCHEMA', dbo, 'table', para_blade, 'column', part_material;
EXEC sp_addextendedproperty 'MS_Description', '是否涂层', 'SCHEMA', dbo, 'table', para_blade, 'column', paintcoat_flag;
EXEC sp_addextendedproperty 'MS_Description', '附加技术条件', 'SCHEMA', dbo, 'table', para_blade, 'column', technical_conditions;
EXEC sp_addextendedproperty 'MS_Description', '附加技术条件说明', 'SCHEMA', dbo, 'table', para_blade, 'column', conditions_info;
EXEC sp_addextendedproperty 'MS_Description', '品牌', 'SCHEMA', dbo, 'table', para_blade, 'column', brand;
EXEC sp_addextendedproperty 'MS_Description', '制式', 'SCHEMA', dbo, 'table', para_blade, 'column', types;
EXEC sp_addextendedproperty 'MS_Description', '涂层材质', 'SCHEMA', dbo, 'table', para_blade, 'column', coating_material;
EXEC sp_addextendedproperty 'MS_Description', '加工分类', 'SCHEMA', dbo, 'table', para_blade, 'column', processing_classify;
EXEC sp_addextendedproperty 'MS_Description', '刀片后角', 'SCHEMA', dbo, 'table', para_blade, 'column', blade_posterior;
EXEC sp_addextendedproperty 'MS_Description', '切削方向', 'SCHEMA', dbo, 'table', para_blade, 'column', cutting_direction;
EXEC sp_addextendedproperty 'MS_Description', '刀片宽度', 'SCHEMA', dbo, 'table', para_blade, 'column', blade_wide;
EXEC sp_addextendedproperty 'MS_Description', '刀片尺寸', 'SCHEMA', dbo, 'table', para_blade, 'column', blade_size;
EXEC sp_addextendedproperty 'MS_Description', '内外螺纹', 'SCHEMA', dbo, 'table', para_blade, 'column', in_out_thread;
EXEC sp_addextendedproperty 'MS_Description', '螺纹标准', 'SCHEMA', dbo, 'table', para_blade, 'column', thread_standard;
EXEC sp_addextendedproperty 'MS_Description', '牙型角度', 'SCHEMA', dbo, 'table', para_blade, 'column', dental_angle;
EXEC sp_addextendedproperty 'MS_Description', '螺距', 'SCHEMA', dbo, 'table', para_blade, 'column', pitch;
EXEC sp_addextendedproperty 'MS_Description', '最小加工内螺纹公称直径', 'SCHEMA', dbo, 'table', para_blade, 'column', min_internal_thread;
EXEC sp_addextendedproperty 'MS_Description', '租户号', 'SCHEMA', dbo, 'table', para_blade, 'column', tenant_id;
EXEC sp_addextendedproperty 'MS_Description', '创建人', 'SCHEMA', dbo, 'table', para_blade, 'column', created_by;
EXEC sp_addextendedproperty 'MS_Description', '创建时间', 'SCHEMA', dbo, 'table', para_blade, 'column', created_time;
EXEC sp_addextendedproperty 'MS_Description', '更新人', 'SCHEMA', dbo, 'table', para_blade, 'column', updated_by;
EXEC sp_addextendedproperty 'MS_Description', '更新时间', 'SCHEMA', dbo, 'table', para_blade, 'column', updated_time;

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[outbound_order]') AND type in (N'U')) DROP TABLE [dbo].[outbound_order];
CREATE TABLE [dbo].[outbound_order](
    id VARCHAR(32) NOT NULL,
    out_storehouse_type VARCHAR(32) NOT NULL,
    is_return INT,
    handler VARCHAR(32) NOT NULL,
    reviewer VARCHAR(32),
    order_status VARCHAR(32) NOT NULL,
    out_status VARCHAR(255),
    audit_date DATETIME,
    approval_opinion VARCHAR(128),
    subject_matter VARCHAR(128),
    outbound_time DATETIME NOT NULL,
    remark VARCHAR(128),
    tenant_id VARCHAR,
    created_by VARCHAR(32),
    created_time DATETIME,
    updated_by VARCHAR(32),
    updated_time DATETIME,
    PRIMARY KEY (id)
);

EXEC sp_addextendedproperty 'MS_Description', '出库申请单', 'SCHEMA', dbo, 'table', outbound_order, null, null;
EXEC sp_addextendedproperty 'MS_Description', '出库单编号', 'SCHEMA', dbo, 'table', outbound_order, 'column', id;
EXEC sp_addextendedproperty 'MS_Description', '出库类型', 'SCHEMA', dbo, 'table', outbound_order, 'column', out_storehouse_type;
EXEC sp_addextendedproperty 'MS_Description', '是否归还;1未归还（默认）；2.已归还', 'SCHEMA', dbo, 'table', outbound_order, 'column', is_return;
EXEC sp_addextendedproperty 'MS_Description', '经手人', 'SCHEMA', dbo, 'table', outbound_order, 'column', handler;
EXEC sp_addextendedproperty 'MS_Description', '审核人', 'SCHEMA', dbo, 'table', outbound_order, 'column', reviewer;
EXEC sp_addextendedproperty 'MS_Description', '单子状态', 'SCHEMA', dbo, 'table', outbound_order, 'column', order_status;
EXEC sp_addextendedproperty 'MS_Description', '出库状态;1.未出库；2.部分出库；3.出库完成', 'SCHEMA', dbo, 'table', outbound_order, 'column', out_status;
EXEC sp_addextendedproperty 'MS_Description', '审核时间', 'SCHEMA', dbo, 'table', outbound_order, 'column', audit_date;
EXEC sp_addextendedproperty 'MS_Description', '审核意见', 'SCHEMA', dbo, 'table', outbound_order, 'column', approval_opinion;
EXEC sp_addextendedproperty 'MS_Description', '领用事由', 'SCHEMA', dbo, 'table', outbound_order, 'column', subject_matter;
EXEC sp_addextendedproperty 'MS_Description', '出库时间', 'SCHEMA', dbo, 'table', outbound_order, 'column', outbound_time;
EXEC sp_addextendedproperty 'MS_Description', '备注', 'SCHEMA', dbo, 'table', outbound_order, 'column', remark;
EXEC sp_addextendedproperty 'MS_Description', '租户号', 'SCHEMA', dbo, 'table', outbound_order, 'column', tenant_id;
EXEC sp_addextendedproperty 'MS_Description', '操作员', 'SCHEMA', dbo, 'table', outbound_order, 'column', created_by;
EXEC sp_addextendedproperty 'MS_Description', '创建时间', 'SCHEMA', dbo, 'table', outbound_order, 'column', created_time;
EXEC sp_addextendedproperty 'MS_Description', '更新人', 'SCHEMA', dbo, 'table', outbound_order, 'column', updated_by;
EXEC sp_addextendedproperty 'MS_Description', '更新时间', 'SCHEMA', dbo, 'table', outbound_order, 'column', updated_time;

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[inbound_order]') AND type in (N'U')) DROP TABLE [dbo].[inbound_order];
CREATE TABLE [dbo].[inbound_order](
    id VARCHAR(32) NOT NULL,
    inbound_time DATETIME(255),
    in_storehouse_type VARCHAR(32) NOT NULL,
    handler VARCHAR(32),
    borrow_num VARCHAR(32),
    reviewer VARCHAR(32),
    approval_date DATETIME,
    approval_opinion VARCHAR(128),
    order_status VARCHAR(32),
    in_status VARCHAR(32),
    application_reason VARCHAR(128),
    remark VARCHAR(128),
    tenant_id VARCHAR,
    created_by VARCHAR(32),
    created_time DATETIME,
    updated_by VARCHAR(32),
    updated_time DATETIME,
    PRIMARY KEY (id)
);

EXEC sp_addextendedproperty 'MS_Description', '入库申请单', 'SCHEMA', dbo, 'table', inbound_order, null, null;
EXEC sp_addextendedproperty 'MS_Description', '主键-入库单号', 'SCHEMA', dbo, 'table', inbound_order, 'column', id;
EXEC sp_addextendedproperty 'MS_Description', '入库时间', 'SCHEMA', dbo, 'table', inbound_order, 'column', inbound_time;
EXEC sp_addextendedproperty 'MS_Description', '入库类型', 'SCHEMA', dbo, 'table', inbound_order, 'column', in_storehouse_type;
EXEC sp_addextendedproperty 'MS_Description', '经手人', 'SCHEMA', dbo, 'table', inbound_order, 'column', handler;
EXEC sp_addextendedproperty 'MS_Description', '借用单号', 'SCHEMA', dbo, 'table', inbound_order, 'column', borrow_num;
EXEC sp_addextendedproperty 'MS_Description', '审核人', 'SCHEMA', dbo, 'table', inbound_order, 'column', reviewer;
EXEC sp_addextendedproperty 'MS_Description', '审核时间', 'SCHEMA', dbo, 'table', inbound_order, 'column', approval_date;
EXEC sp_addextendedproperty 'MS_Description', '审核意见', 'SCHEMA', dbo, 'table', inbound_order, 'column', approval_opinion;
EXEC sp_addextendedproperty 'MS_Description', '单子状态', 'SCHEMA', dbo, 'table', inbound_order, 'column', order_status;
EXEC sp_addextendedproperty 'MS_Description', '入库单状态;1.未入库；2.部分入库；3.入库完成', 'SCHEMA', dbo, 'table', inbound_order, 'column', in_status;
EXEC sp_addextendedproperty 'MS_Description', '申请原因', 'SCHEMA', dbo, 'table', inbound_order, 'column', application_reason;
EXEC sp_addextendedproperty 'MS_Description', '备注', 'SCHEMA', dbo, 'table', inbound_order, 'column', remark;
EXEC sp_addextendedproperty 'MS_Description', '租户号', 'SCHEMA', dbo, 'table', inbound_order, 'column', tenant_id;
EXEC sp_addextendedproperty 'MS_Description', '操作员', 'SCHEMA', dbo, 'table', inbound_order, 'column', created_by;
EXEC sp_addextendedproperty 'MS_Description', '申请时间', 'SCHEMA', dbo, 'table', inbound_order, 'column', created_time;
EXEC sp_addextendedproperty 'MS_Description', '更新人', 'SCHEMA', dbo, 'table', inbound_order, 'column', updated_by;
EXEC sp_addextendedproperty 'MS_Description', '更新时间', 'SCHEMA', dbo, 'table', inbound_order, 'column', updated_time;

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[outbound_detail]') AND type in (N'U')) DROP TABLE [dbo].[outbound_detail];
CREATE TABLE [dbo].[outbound_detail](
    id VARCHAR(32) NOT NULL,
    out_storehouse_id VARCHAR(32) NOT NULL,
    tool_code VARCHAR(32) NOT NULL,
    tool_id VARCHAR(32),
    outbound_quantity DECIMAL(64) NOT NULL,
    out_actual_count DECIMAL(64),
    storage_location VARCHAR(64),
    outbound_location VARCHAR(255),
    out_status VARCHAR(32) NOT NULL,
    tenant_id VARCHAR,
    created_by VARCHAR(32),
    created_time DATETIME,
    updated_by VARCHAR(32),
    updated_time DATETIME,
    PRIMARY KEY (id)
);

EXEC sp_addextendedproperty 'MS_Description', '出库申请明细', 'SCHEMA', dbo, 'table', outbound_detail, null, null;
EXEC sp_addextendedproperty 'MS_Description', '主键', 'SCHEMA', dbo, 'table', outbound_detail, 'column', id;
EXEC sp_addextendedproperty 'MS_Description', '出库单号', 'SCHEMA', dbo, 'table', outbound_detail, 'column', out_storehouse_id;
EXEC sp_addextendedproperty 'MS_Description', '刀具编码', 'SCHEMA', dbo, 'table', outbound_detail, 'column', tool_code;
EXEC sp_addextendedproperty 'MS_Description', '刀具编号', 'SCHEMA', dbo, 'table', outbound_detail, 'column', tool_id;
EXEC sp_addextendedproperty 'MS_Description', '申请出库数量', 'SCHEMA', dbo, 'table', outbound_detail, 'column', outbound_quantity;
EXEC sp_addextendedproperty 'MS_Description', '实际出库数量', 'SCHEMA', dbo, 'table', outbound_detail, 'column', out_actual_count;
EXEC sp_addextendedproperty 'MS_Description', '仓库', 'SCHEMA', dbo, 'table', outbound_detail, 'column', storage_location;
EXEC sp_addextendedproperty 'MS_Description', '出库库位', 'SCHEMA', dbo, 'table', outbound_detail, 'column', outbound_location;
EXEC sp_addextendedproperty 'MS_Description', '出库状态;1.未出库；2.部分出库；3.出库完成', 'SCHEMA', dbo, 'table', outbound_detail, 'column', out_status;
EXEC sp_addextendedproperty 'MS_Description', '租户号', 'SCHEMA', dbo, 'table', outbound_detail, 'column', tenant_id;
EXEC sp_addextendedproperty 'MS_Description', '操作员', 'SCHEMA', dbo, 'table', outbound_detail, 'column', created_by;
EXEC sp_addextendedproperty 'MS_Description', '出库时间', 'SCHEMA', dbo, 'table', outbound_detail, 'column', created_time;
EXEC sp_addextendedproperty 'MS_Description', '更新人', 'SCHEMA', dbo, 'table', outbound_detail, 'column', updated_by;
EXEC sp_addextendedproperty 'MS_Description', '更新时间', 'SCHEMA', dbo, 'table', outbound_detail, 'column', updated_time;

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[inbound_detail]') AND type in (N'U')) DROP TABLE [dbo].[inbound_detail];
CREATE TABLE [dbo].[inbound_detail](
    id VARCHAR(32) NOT NULL,
    goods_shelves_id VARCHAR(32) NOT NULL,
    tool_code VARCHAR(32) NOT NULL,
    tool_id VARCHAR(32),
    in_storage_quantity DECIMAL(64) NOT NULL,
    in_actual_count DECIMAL(64),
    out_status VARCHAR(32),
    remark VARCHAR(128),
    tenant_id VARCHAR,
    created_by VARCHAR(32),
    created_time DATETIME,
    updated_by VARCHAR(32),
    updated_time DATETIME,
    PRIMARY KEY (id)
);

EXEC sp_addextendedproperty 'MS_Description', '入库申请明细', 'SCHEMA', dbo, 'table', inbound_detail, null, null;
EXEC sp_addextendedproperty 'MS_Description', '主键', 'SCHEMA', dbo, 'table', inbound_detail, 'column', id;
EXEC sp_addextendedproperty 'MS_Description', '货架号/存储位置', 'SCHEMA', dbo, 'table', inbound_detail, 'column', goods_shelves_id;
EXEC sp_addextendedproperty 'MS_Description', '工具编码', 'SCHEMA', dbo, 'table', inbound_detail, 'column', tool_code;
EXEC sp_addextendedproperty 'MS_Description', '工具编号', 'SCHEMA', dbo, 'table', inbound_detail, 'column', tool_id;
EXEC sp_addextendedproperty 'MS_Description', '入库数量', 'SCHEMA', dbo, 'table', inbound_detail, 'column', in_storage_quantity;
EXEC sp_addextendedproperty 'MS_Description', '实际入库数量', 'SCHEMA', dbo, 'table', inbound_detail, 'column', in_actual_count;
EXEC sp_addextendedproperty 'MS_Description', '出库状态;1.未入库；2.部分入库；3.入库完成', 'SCHEMA', dbo, 'table', inbound_detail, 'column', out_status;
EXEC sp_addextendedproperty 'MS_Description', '备注', 'SCHEMA', dbo, 'table', inbound_detail, 'column', remark;
EXEC sp_addextendedproperty 'MS_Description', '租户号', 'SCHEMA', dbo, 'table', inbound_detail, 'column', tenant_id;
EXEC sp_addextendedproperty 'MS_Description', '创建人', 'SCHEMA', dbo, 'table', inbound_detail, 'column', created_by;
EXEC sp_addextendedproperty 'MS_Description', '创建时间', 'SCHEMA', dbo, 'table', inbound_detail, 'column', created_time;
EXEC sp_addextendedproperty 'MS_Description', '更新人', 'SCHEMA', dbo, 'table', inbound_detail, 'column', updated_by;
EXEC sp_addextendedproperty 'MS_Description', '更新时间', 'SCHEMA', dbo, 'table', inbound_detail, 'column', updated_time;

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[tools_config_property]') AND type in (N'U')) DROP TABLE [dbo].[tools_config_property];
CREATE TABLE [dbo].[tools_config_property](
    id VARCHAR(32) NOT NULL,
    classify_id VARCHAR(32) NOT NULL,
    chinese_name VARCHAR(128),
    foreign_language_name VARCHAR(128),
    application_type INT NOT NULL,
    standard_level VARCHAR(16),
    standard_code VARCHAR(32),
    tool_model VARCHAR(128) NOT NULL,
    supplier_id VARCHAR(128),
    province_city VARCHAR(255),
    warehouse_id VARCHAR(128),
    position_code VARCHAR(255),
    storage_location VARCHAR(64),
    main_unit VARCHAR(64),
    auxiliary_unit VARCHAR(64),
    main_count VARCHAR(255),
    auxiliary_count VARCHAR(255),
    auxiliary_unit_flag VARCHAR(8),
    price DECIMAL,
    lower_inventory DECIMAL,
    highest_inventory VARCHAR,
    status VARCHAR(6),
    remark VARCHAR(255),
    tenant_id VARCHAR,
    created_by VARCHAR(32),
    created_time DATETIME,
    updated_by VARCHAR(32),
    updated_time DATETIME,
    PRIMARY KEY (id)
);

EXEC sp_addextendedproperty 'MS_Description', '工具通用性质--参数', 'SCHEMA', dbo, 'table', tools_config_property, null, null;
EXEC sp_addextendedproperty 'MS_Description', '主键', 'SCHEMA', dbo, 'table', tools_config_property, 'column', id;
EXEC sp_addextendedproperty 'MS_Description', '分类编号', 'SCHEMA', dbo, 'table', tools_config_property, 'column', classify_id;
EXEC sp_addextendedproperty 'MS_Description', '中文名称', 'SCHEMA', dbo, 'table', tools_config_property, 'column', chinese_name;
EXEC sp_addextendedproperty 'MS_Description', '英文名称', 'SCHEMA', dbo, 'table', tools_config_property, 'column', foreign_language_name;
EXEC sp_addextendedproperty 'MS_Description', '工具类型;1.通用
2.专用', 'SCHEMA', dbo, 'table', tools_config_property, 'column', application_type;
EXEC sp_addextendedproperty 'MS_Description', '标准级别', 'SCHEMA', dbo, 'table', tools_config_property, 'column', standard_level;
EXEC sp_addextendedproperty 'MS_Description', '标准号', 'SCHEMA', dbo, 'table', tools_config_property, 'column', standard_code;
EXEC sp_addextendedproperty 'MS_Description', '型号/图号', 'SCHEMA', dbo, 'table', tools_config_property, 'column', tool_model;
EXEC sp_addextendedproperty 'MS_Description', '厂家', 'SCHEMA', dbo, 'table', tools_config_property, 'column', supplier_id;
EXEC sp_addextendedproperty 'MS_Description', '仓库省份城市', 'SCHEMA', dbo, 'table', tools_config_property, 'column', province_city;
EXEC sp_addextendedproperty 'MS_Description', '库区/库号', 'SCHEMA', dbo, 'table', tools_config_property, 'column', warehouse_id;
EXEC sp_addextendedproperty 'MS_Description', '库位号;由库区+层+排+列组成，可以是多个库位号以英文点号分割的字符串。', 'SCHEMA', dbo, 'table', tools_config_property, 'column', position_code;
EXEC sp_addextendedproperty 'MS_Description', '存储位置（偏那个厂区的库）', 'SCHEMA', dbo, 'table', tools_config_property, 'column', storage_location;
EXEC sp_addextendedproperty 'MS_Description', '计量主单位', 'SCHEMA', dbo, 'table', tools_config_property, 'column', main_unit;
EXEC sp_addextendedproperty 'MS_Description', '计量辅单位', 'SCHEMA', dbo, 'table', tools_config_property, 'column', auxiliary_unit;
EXEC sp_addextendedproperty 'MS_Description', '计量主单位数量', 'SCHEMA', dbo, 'table', tools_config_property, 'column', main_count;
EXEC sp_addextendedproperty 'MS_Description', '计量辅单位数量', 'SCHEMA', dbo, 'table', tools_config_property, 'column', auxiliary_count;
EXEC sp_addextendedproperty 'MS_Description', '是否有计量辅单位;1,有辅助单位2.无辅助单位', 'SCHEMA', dbo, 'table', tools_config_property, 'column', auxiliary_unit_flag;
EXEC sp_addextendedproperty 'MS_Description', '单价', 'SCHEMA', dbo, 'table', tools_config_property, 'column', price;
EXEC sp_addextendedproperty 'MS_Description', '最低库存', 'SCHEMA', dbo, 'table', tools_config_property, 'column', lower_inventory;
EXEC sp_addextendedproperty 'MS_Description', '最高库存', 'SCHEMA', dbo, 'table', tools_config_property, 'column', highest_inventory;
EXEC sp_addextendedproperty 'MS_Description', '状态;1.启用
2.未启用', 'SCHEMA', dbo, 'table', tools_config_property, 'column', status;
EXEC sp_addextendedproperty 'MS_Description', '备注', 'SCHEMA', dbo, 'table', tools_config_property, 'column', remark;
EXEC sp_addextendedproperty 'MS_Description', '租户号', 'SCHEMA', dbo, 'table', tools_config_property, 'column', tenant_id;
EXEC sp_addextendedproperty 'MS_Description', '创建人', 'SCHEMA', dbo, 'table', tools_config_property, 'column', created_by;
EXEC sp_addextendedproperty 'MS_Description', '创建时间', 'SCHEMA', dbo, 'table', tools_config_property, 'column', created_time;
EXEC sp_addextendedproperty 'MS_Description', '更新人', 'SCHEMA', dbo, 'table', tools_config_property, 'column', updated_by;
EXEC sp_addextendedproperty 'MS_Description', '更新时间', 'SCHEMA', dbo, 'table', tools_config_property, 'column', updated_time;

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[warehouse]') AND type in (N'U')) DROP TABLE [dbo].[warehouse];
CREATE TABLE [dbo].[warehouse](
    id VARCHAR(32) NOT NULL,
    warehouse_id VARCHAR(255),
    warehouse_name VARCHAR(128),
    parent_id VARCHAR(64),
    seq VARCHAR(255),
    leaf_flag VARCHAR(6),
    status VARCHAR(6),
    remark VARCHAR(128),
    tenant_id VARCHAR,
    created_by VARCHAR(32),
    created_time DATETIME,
    updated_by VARCHAR(32),
    updated_time DATETIME,
    PRIMARY KEY (id)
);

EXEC sp_addextendedproperty 'MS_Description', '仓库管理', 'SCHEMA', dbo, 'table', warehouse, null, null;
EXEC sp_addextendedproperty 'MS_Description', '主键', 'SCHEMA', dbo, 'table', warehouse, 'column', id;
EXEC sp_addextendedproperty 'MS_Description', '仓库编号', 'SCHEMA', dbo, 'table', warehouse, 'column', warehouse_id;
EXEC sp_addextendedproperty 'MS_Description', '仓库名称', 'SCHEMA', dbo, 'table', warehouse, 'column', warehouse_name;
EXEC sp_addextendedproperty 'MS_Description', '父节点编号', 'SCHEMA', dbo, 'table', warehouse, 'column', parent_id;
EXEC sp_addextendedproperty 'MS_Description', '展示序号', 'SCHEMA', dbo, 'table', warehouse, 'column', seq;
EXEC sp_addextendedproperty 'MS_Description', '是否叶子节点;1是2否', 'SCHEMA', dbo, 'table', warehouse, 'column', leaf_flag;
EXEC sp_addextendedproperty 'MS_Description', '状态;1.启用；2.停用', 'SCHEMA', dbo, 'table', warehouse, 'column', status;
EXEC sp_addextendedproperty 'MS_Description', '备注', 'SCHEMA', dbo, 'table', warehouse, 'column', remark;
EXEC sp_addextendedproperty 'MS_Description', '租户号', 'SCHEMA', dbo, 'table', warehouse, 'column', tenant_id;
EXEC sp_addextendedproperty 'MS_Description', '创建人', 'SCHEMA', dbo, 'table', warehouse, 'column', created_by;
EXEC sp_addextendedproperty 'MS_Description', '创建时间', 'SCHEMA', dbo, 'table', warehouse, 'column', created_time;
EXEC sp_addextendedproperty 'MS_Description', '更新人', 'SCHEMA', dbo, 'table', warehouse, 'column', updated_by;
EXEC sp_addextendedproperty 'MS_Description', '更新时间', 'SCHEMA', dbo, 'table', warehouse, 'column', updated_time;

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[goods_shelves]') AND type in (N'U')) DROP TABLE [dbo].[goods_shelves];
CREATE TABLE [dbo].[goods_shelves](
    id VARCHAR(32) NOT NULL,
    warehouse_id VARCHAR(32) NOT NULL,
    location_code VARCHAR(255) NOT NULL,
    storey VARCHAR(32) NOT NULL,
    arrange VARCHAR(32) NOT NULL,
    column_number VARCHAR(32) NOT NULL,
    cells_num VARCHAR(32),
    shelf_number VARCHAR(64),
    shelf_name VARCHAR(64),
    remark VARCHAR(128),
    tenant_id VARCHAR,
    created_by VARCHAR(32),
    created_time DATETIME,
    updated_by VARCHAR(32),
    updated_time DATETIME,
    PRIMARY KEY (id)
);

EXEC sp_addextendedproperty 'MS_Description', '货架管理', 'SCHEMA', dbo, 'table', goods_shelves, null, null;
EXEC sp_addextendedproperty 'MS_Description', '主键', 'SCHEMA', dbo, 'table', goods_shelves, 'column', id;
EXEC sp_addextendedproperty 'MS_Description', '仓库编号', 'SCHEMA', dbo, 'table', goods_shelves, 'column', warehouse_id;
EXEC sp_addextendedproperty 'MS_Description', '库位号', 'SCHEMA', dbo, 'table', goods_shelves, 'column', location_code;
EXEC sp_addextendedproperty 'MS_Description', '层数', 'SCHEMA', dbo, 'table', goods_shelves, 'column', storey;
EXEC sp_addextendedproperty 'MS_Description', '排数', 'SCHEMA', dbo, 'table', goods_shelves, 'column', arrange;
EXEC sp_addextendedproperty 'MS_Description', '列数', 'SCHEMA', dbo, 'table', goods_shelves, 'column', column_number;
EXEC sp_addextendedproperty 'MS_Description', '格数;默认值为1', 'SCHEMA', dbo, 'table', goods_shelves, 'column', cells_num;
EXEC sp_addextendedproperty 'MS_Description', '货架编号', 'SCHEMA', dbo, 'table', goods_shelves, 'column', shelf_number;
EXEC sp_addextendedproperty 'MS_Description', '货架名称', 'SCHEMA', dbo, 'table', goods_shelves, 'column', shelf_name;
EXEC sp_addextendedproperty 'MS_Description', '备注', 'SCHEMA', dbo, 'table', goods_shelves, 'column', remark;
EXEC sp_addextendedproperty 'MS_Description', '租户号', 'SCHEMA', dbo, 'table', goods_shelves, 'column', tenant_id;
EXEC sp_addextendedproperty 'MS_Description', '创建人', 'SCHEMA', dbo, 'table', goods_shelves, 'column', created_by;
EXEC sp_addextendedproperty 'MS_Description', '创建时间', 'SCHEMA', dbo, 'table', goods_shelves, 'column', created_time;
EXEC sp_addextendedproperty 'MS_Description', '更新人', 'SCHEMA', dbo, 'table', goods_shelves, 'column', updated_by;
EXEC sp_addextendedproperty 'MS_Description', '更新时间', 'SCHEMA', dbo, 'table', goods_shelves, 'column', updated_time;

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[in_store_detail]') AND type in (N'U')) DROP TABLE [dbo].[in_store_detail];
CREATE TABLE [dbo].[in_store_detail](
    id VARCHAR(32) NOT NULL,
    tool_code VARCHAR(32) NOT NULL,
    tool_id VARCHAR(32),
    in_storehouse_type VARCHAR(32),
    goods_shelves_id VARCHAR(32),
    in_number DECIMAL(64),
    in_storehouse_id VARCHAR(32),
    operate_type VARCHAR(64),
    inbound_time DATETIME(24),
    tenant_id VARCHAR,
    created_by VARCHAR(32),
    created_time DATETIME,
    updated_by VARCHAR(32),
    updated_time DATETIME,
    PRIMARY KEY (id)
);

EXEC sp_addextendedproperty 'MS_Description', '入库明细表-描述刀具存放、发生的数量', 'SCHEMA', dbo, 'table', in_store_detail, null, null;
EXEC sp_addextendedproperty 'MS_Description', '主键', 'SCHEMA', dbo, 'table', in_store_detail, 'column', id;
EXEC sp_addextendedproperty 'MS_Description', '工具编码', 'SCHEMA', dbo, 'table', in_store_detail, 'column', tool_code;
EXEC sp_addextendedproperty 'MS_Description', '工具编号', 'SCHEMA', dbo, 'table', in_store_detail, 'column', tool_id;
EXEC sp_addextendedproperty 'MS_Description', '工具入库方式', 'SCHEMA', dbo, 'table', in_store_detail, 'column', in_storehouse_type;
EXEC sp_addextendedproperty 'MS_Description', '库位号', 'SCHEMA', dbo, 'table', in_store_detail, 'column', goods_shelves_id;
EXEC sp_addextendedproperty 'MS_Description', '入库数量', 'SCHEMA', dbo, 'table', in_store_detail, 'column', in_number;
EXEC sp_addextendedproperty 'MS_Description', '入库申请单号', 'SCHEMA', dbo, 'table', in_store_detail, 'column', in_storehouse_id;
EXEC sp_addextendedproperty 'MS_Description', '入库操作方式;1.按申请单
2.手工操作', 'SCHEMA', dbo, 'table', in_store_detail, 'column', operate_type;
EXEC sp_addextendedproperty 'MS_Description', '入库时间', 'SCHEMA', dbo, 'table', in_store_detail, 'column', inbound_time;
EXEC sp_addextendedproperty 'MS_Description', '租户号', 'SCHEMA', dbo, 'table', in_store_detail, 'column', tenant_id;
EXEC sp_addextendedproperty 'MS_Description', '创建人', 'SCHEMA', dbo, 'table', in_store_detail, 'column', created_by;
EXEC sp_addextendedproperty 'MS_Description', '创建时间', 'SCHEMA', dbo, 'table', in_store_detail, 'column', created_time;
EXEC sp_addextendedproperty 'MS_Description', '更新人', 'SCHEMA', dbo, 'table', in_store_detail, 'column', updated_by;
EXEC sp_addextendedproperty 'MS_Description', '更新时间', 'SCHEMA', dbo, 'table', in_store_detail, 'column', updated_time;

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[out_store_detail]') AND type in (N'U')) DROP TABLE [dbo].[out_store_detail];
CREATE TABLE [dbo].[out_store_detail](
    id VARCHAR(32) NOT NULL,
    tool_code VARCHAR(32) NOT NULL,
    tool_id VARCHAR(32),
    out_storehouse_type VARCHAR(32),
    goods_shelves_code VARCHAR(64),
    out_number DECIMAL(64) NOT NULL,
    in_storehouse_id VARCHAR(128),
    operate_type VARCHAR(64),
    tenant_id VARCHAR,
    created_by VARCHAR(32),
    created_time DATETIME,
    updated_by VARCHAR(32),
    updated_time DATETIME,
    PRIMARY KEY (id)
);

EXEC sp_addextendedproperty 'MS_Description', '描述出库的库位、数量关系表', 'SCHEMA', dbo, 'table', out_store_detail, null, null;
EXEC sp_addextendedproperty 'MS_Description', '主键', 'SCHEMA', dbo, 'table', out_store_detail, 'column', id;
EXEC sp_addextendedproperty 'MS_Description', '工具编码', 'SCHEMA', dbo, 'table', out_store_detail, 'column', tool_code;
EXEC sp_addextendedproperty 'MS_Description', '工具编号', 'SCHEMA', dbo, 'table', out_store_detail, 'column', tool_id;
EXEC sp_addextendedproperty 'MS_Description', '出库类型', 'SCHEMA', dbo, 'table', out_store_detail, 'column', out_storehouse_type;
EXEC sp_addextendedproperty 'MS_Description', '库位号', 'SCHEMA', dbo, 'table', out_store_detail, 'column', goods_shelves_code;
EXEC sp_addextendedproperty 'MS_Description', '出库数量', 'SCHEMA', dbo, 'table', out_store_detail, 'column', out_number;
EXEC sp_addextendedproperty 'MS_Description', '出库申请单号', 'SCHEMA', dbo, 'table', out_store_detail, 'column', in_storehouse_id;
EXEC sp_addextendedproperty 'MS_Description', '出库操作方式;1.按申请单
2.手工操作', 'SCHEMA', dbo, 'table', out_store_detail, 'column', operate_type;
EXEC sp_addextendedproperty 'MS_Description', '租户号', 'SCHEMA', dbo, 'table', out_store_detail, 'column', tenant_id;
EXEC sp_addextendedproperty 'MS_Description', '创建人', 'SCHEMA', dbo, 'table', out_store_detail, 'column', created_by;
EXEC sp_addextendedproperty 'MS_Description', '创建时间', 'SCHEMA', dbo, 'table', out_store_detail, 'column', created_time;
EXEC sp_addextendedproperty 'MS_Description', '更新人', 'SCHEMA', dbo, 'table', out_store_detail, 'column', updated_by;
EXEC sp_addextendedproperty 'MS_Description', '更新时间', 'SCHEMA', dbo, 'table', out_store_detail, 'column', updated_time;

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[para_common_tool]') AND type in (N'U')) DROP TABLE [dbo].[para_common_tool];
CREATE TABLE [dbo].[para_common_tool](
    id VARCHAR(32) NOT NULL,
    classify_id VARCHAR(32),
    tool_code VARCHAR(32),
    sign_code VARCHAR(16),
    chinese_name VARCHAR(128),
    foreign_language_name VARCHAR(128),
    standard_level VARCHAR(16),
    standard_code VARCHAR(32),
    position_code VARCHAR(255),
    tool_model VARCHAR(255),
    tool_material VARCHAR(255),
    part_material VARCHAR(255),
    remark VARCHAR(255),
    tenant_id VARCHAR,
    created_by VARCHAR(32),
    created_time DATETIME,
    updated_by VARCHAR(32),
    updated_time DATETIME,
    PRIMARY KEY (id)
);

EXEC sp_addextendedproperty 'MS_Description', '工具标识', 'SCHEMA', dbo, 'table', para_common_tool, null, null;
EXEC sp_addextendedproperty 'MS_Description', '主键', 'SCHEMA', dbo, 'table', para_common_tool, 'column', id;
EXEC sp_addextendedproperty 'MS_Description', '工具分类编号', 'SCHEMA', dbo, 'table', para_common_tool, 'column', classify_id;
EXEC sp_addextendedproperty 'MS_Description', '工具编号', 'SCHEMA', dbo, 'table', para_common_tool, 'column', tool_code;
EXEC sp_addextendedproperty 'MS_Description', '序号（或企业内源码）', 'SCHEMA', dbo, 'table', para_common_tool, 'column', sign_code;
EXEC sp_addextendedproperty 'MS_Description', '中文名称', 'SCHEMA', dbo, 'table', para_common_tool, 'column', chinese_name;
EXEC sp_addextendedproperty 'MS_Description', '外文名称', 'SCHEMA', dbo, 'table', para_common_tool, 'column', foreign_language_name;
EXEC sp_addextendedproperty 'MS_Description', '标准级别', 'SCHEMA', dbo, 'table', para_common_tool, 'column', standard_level;
EXEC sp_addextendedproperty 'MS_Description', '标准号', 'SCHEMA', dbo, 'table', para_common_tool, 'column', standard_code;
EXEC sp_addextendedproperty 'MS_Description', '库位号;由库区+层+排+列组成，可以是多个库位号以英文点号分割的字符串。', 'SCHEMA', dbo, 'table', para_common_tool, 'column', position_code;
EXEC sp_addextendedproperty 'MS_Description', '型号/图号', 'SCHEMA', dbo, 'table', para_common_tool, 'column', tool_model;
EXEC sp_addextendedproperty 'MS_Description', '刀具材料', 'SCHEMA', dbo, 'table', para_common_tool, 'column', tool_material;
EXEC sp_addextendedproperty 'MS_Description', '零件材料', 'SCHEMA', dbo, 'table', para_common_tool, 'column', part_material;
EXEC sp_addextendedproperty 'MS_Description', '备注', 'SCHEMA', dbo, 'table', para_common_tool, 'column', remark;
EXEC sp_addextendedproperty 'MS_Description', '租户号', 'SCHEMA', dbo, 'table', para_common_tool, 'column', tenant_id;
EXEC sp_addextendedproperty 'MS_Description', '创建人', 'SCHEMA', dbo, 'table', para_common_tool, 'column', created_by;
EXEC sp_addextendedproperty 'MS_Description', '创建时间', 'SCHEMA', dbo, 'table', para_common_tool, 'column', created_time;
EXEC sp_addextendedproperty 'MS_Description', '更新人', 'SCHEMA', dbo, 'table', para_common_tool, 'column', updated_by;
EXEC sp_addextendedproperty 'MS_Description', '更新时间', 'SCHEMA', dbo, 'table', para_common_tool, 'column', updated_time;

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[tool_sharpening]') AND type in (N'U')) DROP TABLE [dbo].[tool_sharpening];
CREATE TABLE [dbo].[tool_sharpening](
    id VARCHAR(32,32) NOT NULL,
    tool_code VARCHAR(32) NOT NULL,
    tool_id VARCHAR(32,32),
    sharpening_time DATETIME(24) NOT NULL,
    sharpening_result VARCHAR(255),
    responsible_person VARCHAR(24),
    remark VARCHAR(255),
    tenant_id VARCHAR,
    created_by VARCHAR(32),
    created_time DATETIME,
    updated_by VARCHAR(32),
    updated_time DATETIME,
    PRIMARY KEY (id)
);

EXEC sp_addextendedproperty 'MS_Description', '刀具刃磨', 'SCHEMA', dbo, 'table', tool_sharpening, null, null;
EXEC sp_addextendedproperty 'MS_Description', '主键', 'SCHEMA', dbo, 'table', tool_sharpening, 'column', id;
EXEC sp_addextendedproperty 'MS_Description', '工具编码', 'SCHEMA', dbo, 'table', tool_sharpening, 'column', tool_code;
EXEC sp_addextendedproperty 'MS_Description', '工具编号', 'SCHEMA', dbo, 'table', tool_sharpening, 'column', tool_id;
EXEC sp_addextendedproperty 'MS_Description', '刃磨时间', 'SCHEMA', dbo, 'table', tool_sharpening, 'column', sharpening_time;
EXEC sp_addextendedproperty 'MS_Description', '刃磨结果及建议', 'SCHEMA', dbo, 'table', tool_sharpening, 'column', sharpening_result;
EXEC sp_addextendedproperty 'MS_Description', '责任人', 'SCHEMA', dbo, 'table', tool_sharpening, 'column', responsible_person;
EXEC sp_addextendedproperty 'MS_Description', '备注', 'SCHEMA', dbo, 'table', tool_sharpening, 'column', remark;
EXEC sp_addextendedproperty 'MS_Description', '租户号', 'SCHEMA', dbo, 'table', tool_sharpening, 'column', tenant_id;
EXEC sp_addextendedproperty 'MS_Description', '创建人', 'SCHEMA', dbo, 'table', tool_sharpening, 'column', created_by;
EXEC sp_addextendedproperty 'MS_Description', '创建时间', 'SCHEMA', dbo, 'table', tool_sharpening, 'column', created_time;
EXEC sp_addextendedproperty 'MS_Description', '更新人', 'SCHEMA', dbo, 'table', tool_sharpening, 'column', updated_by;
EXEC sp_addextendedproperty 'MS_Description', '更新时间', 'SCHEMA', dbo, 'table', tool_sharpening, 'column', updated_time;

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[loss_bound]') AND type in (N'U')) DROP TABLE [dbo].[loss_bound];
CREATE TABLE [dbo].[loss_bound](
    id VARCHAR(32) NOT NULL,
    losser VARCHAR(64),
    handler VARCHAR(64),
    loss_time DATETIME(32),
    reviewer VARCHAR(64),
    approval_date DATETIME(255),
    order_status VARCHAR(32),
    approval_opinion VARCHAR(255),
    loss_reason VARCHAR(255),
    remark VARCHAR(255),
    tenant_id VARCHAR,
    created_by VARCHAR(32),
    created_time DATETIME,
    updated_by VARCHAR(32),
    updated_time DATETIME,
    PRIMARY KEY (id)
);

EXEC sp_addextendedproperty 'MS_Description', '工具报损单', 'SCHEMA', dbo, 'table', loss_bound, null, null;
EXEC sp_addextendedproperty 'MS_Description', '报损单号', 'SCHEMA', dbo, 'table', loss_bound, 'column', id;
EXEC sp_addextendedproperty 'MS_Description', '报损人', 'SCHEMA', dbo, 'table', loss_bound, 'column', losser;
EXEC sp_addextendedproperty 'MS_Description', '经手人', 'SCHEMA', dbo, 'table', loss_bound, 'column', handler;
EXEC sp_addextendedproperty 'MS_Description', '报损时间', 'SCHEMA', dbo, 'table', loss_bound, 'column', loss_time;
EXEC sp_addextendedproperty 'MS_Description', '审核人', 'SCHEMA', dbo, 'table', loss_bound, 'column', reviewer;
EXEC sp_addextendedproperty 'MS_Description', '审核时间', 'SCHEMA', dbo, 'table', loss_bound, 'column', approval_date;
EXEC sp_addextendedproperty 'MS_Description', '单据状态', 'SCHEMA', dbo, 'table', loss_bound, 'column', order_status;
EXEC sp_addextendedproperty 'MS_Description', '审批意见', 'SCHEMA', dbo, 'table', loss_bound, 'column', approval_opinion;
EXEC sp_addextendedproperty 'MS_Description', '损伤原因', 'SCHEMA', dbo, 'table', loss_bound, 'column', loss_reason;
EXEC sp_addextendedproperty 'MS_Description', '备注', 'SCHEMA', dbo, 'table', loss_bound, 'column', remark;
EXEC sp_addextendedproperty 'MS_Description', '租户号', 'SCHEMA', dbo, 'table', loss_bound, 'column', tenant_id;
EXEC sp_addextendedproperty 'MS_Description', '创建人', 'SCHEMA', dbo, 'table', loss_bound, 'column', created_by;
EXEC sp_addextendedproperty 'MS_Description', '创建时间', 'SCHEMA', dbo, 'table', loss_bound, 'column', created_time;
EXEC sp_addextendedproperty 'MS_Description', '更新人', 'SCHEMA', dbo, 'table', loss_bound, 'column', updated_by;
EXEC sp_addextendedproperty 'MS_Description', '更新时间', 'SCHEMA', dbo, 'table', loss_bound, 'column', updated_time;

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[loss_bound_detail]') AND type in (N'U')) DROP TABLE [dbo].[loss_bound_detail];
CREATE TABLE [dbo].[loss_bound_detail](
    id VARCHAR(32) NOT NULL,
    tool_code VARCHAR(32) NOT NULL,
    tool_id VARCHAR(128),
    loss_reason VARCHAR(64),
    loss_number DECIMAL(64) NOT NULL,
    goods_shelves_id VARCHAR(64),
    in_store_date DATETIME(255),
    tenant_id VARCHAR,
    created_by VARCHAR(32),
    created_time DATETIME,
    updated_by VARCHAR(32),
    updated_time DATETIME,
    PRIMARY KEY (id)
);

EXEC sp_addextendedproperty 'MS_Description', '报损单明细', 'SCHEMA', dbo, 'table', loss_bound_detail, null, null;
EXEC sp_addextendedproperty 'MS_Description', '主键', 'SCHEMA', dbo, 'table', loss_bound_detail, 'column', id;
EXEC sp_addextendedproperty 'MS_Description', '工具编码', 'SCHEMA', dbo, 'table', loss_bound_detail, 'column', tool_code;
EXEC sp_addextendedproperty 'MS_Description', '工具编号', 'SCHEMA', dbo, 'table', loss_bound_detail, 'column', tool_id;
EXEC sp_addextendedproperty 'MS_Description', '报损原因', 'SCHEMA', dbo, 'table', loss_bound_detail, 'column', loss_reason;
EXEC sp_addextendedproperty 'MS_Description', '报损数量', 'SCHEMA', dbo, 'table', loss_bound_detail, 'column', loss_number;
EXEC sp_addextendedproperty 'MS_Description', '存储位置(库位号)', 'SCHEMA', dbo, 'table', loss_bound_detail, 'column', goods_shelves_id;
EXEC sp_addextendedproperty 'MS_Description', '入库时间', 'SCHEMA', dbo, 'table', loss_bound_detail, 'column', in_store_date;
EXEC sp_addextendedproperty 'MS_Description', '租户号', 'SCHEMA', dbo, 'table', loss_bound_detail, 'column', tenant_id;
EXEC sp_addextendedproperty 'MS_Description', '创建人', 'SCHEMA', dbo, 'table', loss_bound_detail, 'column', created_by;
EXEC sp_addextendedproperty 'MS_Description', '创建时间', 'SCHEMA', dbo, 'table', loss_bound_detail, 'column', created_time;
EXEC sp_addextendedproperty 'MS_Description', '更新人', 'SCHEMA', dbo, 'table', loss_bound_detail, 'column', updated_by;
EXEC sp_addextendedproperty 'MS_Description', '更新时间', 'SCHEMA', dbo, 'table', loss_bound_detail, 'column', updated_time;

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[stocktaking_bound]') AND type in (N'U')) DROP TABLE [dbo].[stocktaking_bound];
CREATE TABLE [dbo].[stocktaking_bound](
    id VARCHAR(255) NOT NULL,
    stocktaking_type VARCHAR(255),
    order_code VARCHAR(255),
    handler VARCHAR(255),
    reviewer VARCHAR(255),
    stocktaking_name VARCHAR(255),
    remark VARCHAR(255),
    tenant_id VARCHAR,
    created_by VARCHAR(32),
    created_time DATETIME,
    updated_by VARCHAR(32),
    updated_time DATETIME,
    PRIMARY KEY (id)
);

EXEC sp_addextendedproperty 'MS_Description', '工具盘点申请单', 'SCHEMA', dbo, 'table', stocktaking_bound, null, null;
EXEC sp_addextendedproperty 'MS_Description', '主键', 'SCHEMA', dbo, 'table', stocktaking_bound, 'column', id;
EXEC sp_addextendedproperty 'MS_Description', '盘点类型;1.明盘盘点
2.暗盘盘点', 'SCHEMA', dbo, 'table', stocktaking_bound, 'column', stocktaking_type;
EXEC sp_addextendedproperty 'MS_Description', '盘点单号', 'SCHEMA', dbo, 'table', stocktaking_bound, 'column', order_code;
EXEC sp_addextendedproperty 'MS_Description', '经手人', 'SCHEMA', dbo, 'table', stocktaking_bound, 'column', handler;
EXEC sp_addextendedproperty 'MS_Description', '审核人', 'SCHEMA', dbo, 'table', stocktaking_bound, 'column', reviewer;
EXEC sp_addextendedproperty 'MS_Description', '盘点名称', 'SCHEMA', dbo, 'table', stocktaking_bound, 'column', stocktaking_name;
EXEC sp_addextendedproperty 'MS_Description', '备注', 'SCHEMA', dbo, 'table', stocktaking_bound, 'column', remark;
EXEC sp_addextendedproperty 'MS_Description', '租户号', 'SCHEMA', dbo, 'table', stocktaking_bound, 'column', tenant_id;
EXEC sp_addextendedproperty 'MS_Description', '创建人', 'SCHEMA', dbo, 'table', stocktaking_bound, 'column', created_by;
EXEC sp_addextendedproperty 'MS_Description', '创建时间', 'SCHEMA', dbo, 'table', stocktaking_bound, 'column', created_time;
EXEC sp_addextendedproperty 'MS_Description', '更新人', 'SCHEMA', dbo, 'table', stocktaking_bound, 'column', updated_by;
EXEC sp_addextendedproperty 'MS_Description', '更新时间', 'SCHEMA', dbo, 'table', stocktaking_bound, 'column', updated_time;

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[stocktaking_bound_detail]') AND type in (N'U')) DROP TABLE [dbo].[stocktaking_bound_detail];
CREATE TABLE [dbo].[stocktaking_bound_detail](
    id VARCHAR(32) NOT NULL,
    tool_code VARCHAR(32) NOT NULL,
    tool_id VARCHAR(32),
    goods_shelves_id VARCHAR(64),
    book_quantity DATETIME(255),
    available_quantity DATETIME(255),
    practical_quantity DATETIME(255),
    surplus_deficit VARCHAR(36),
    stocktaking_date DATETIME(255),
    remark VARCHAR(218),
    tenant_id VARCHAR,
    created_by VARCHAR(32),
    created_time DATETIME,
    updated_by VARCHAR(32),
    updated_time DATETIME,
    PRIMARY KEY (id)
);

EXEC sp_addextendedproperty 'MS_Description', '盘点单明细', 'SCHEMA', dbo, 'table', stocktaking_bound_detail, null, null;
EXEC sp_addextendedproperty 'MS_Description', '主键', 'SCHEMA', dbo, 'table', stocktaking_bound_detail, 'column', id;
EXEC sp_addextendedproperty 'MS_Description', '工具编码', 'SCHEMA', dbo, 'table', stocktaking_bound_detail, 'column', tool_code;
EXEC sp_addextendedproperty 'MS_Description', '工具编号', 'SCHEMA', dbo, 'table', stocktaking_bound_detail, 'column', tool_id;
EXEC sp_addextendedproperty 'MS_Description', '库存号', 'SCHEMA', dbo, 'table', stocktaking_bound_detail, 'column', goods_shelves_id;
EXEC sp_addextendedproperty 'MS_Description', '账面数量', 'SCHEMA', dbo, 'table', stocktaking_bound_detail, 'column', book_quantity;
EXEC sp_addextendedproperty 'MS_Description', '可用数量', 'SCHEMA', dbo, 'table', stocktaking_bound_detail, 'column', available_quantity;
EXEC sp_addextendedproperty 'MS_Description', '实盘数量', 'SCHEMA', dbo, 'table', stocktaking_bound_detail, 'column', practical_quantity;
EXEC sp_addextendedproperty 'MS_Description', '盘盈盘亏;1.盘盈
2.盘亏', 'SCHEMA', dbo, 'table', stocktaking_bound_detail, 'column', surplus_deficit;
EXEC sp_addextendedproperty 'MS_Description', '盘库时间', 'SCHEMA', dbo, 'table', stocktaking_bound_detail, 'column', stocktaking_date;
EXEC sp_addextendedproperty 'MS_Description', '备注', 'SCHEMA', dbo, 'table', stocktaking_bound_detail, 'column', remark;
EXEC sp_addextendedproperty 'MS_Description', '租户号', 'SCHEMA', dbo, 'table', stocktaking_bound_detail, 'column', tenant_id;
EXEC sp_addextendedproperty 'MS_Description', '创建人', 'SCHEMA', dbo, 'table', stocktaking_bound_detail, 'column', created_by;
EXEC sp_addextendedproperty 'MS_Description', '创建时间', 'SCHEMA', dbo, 'table', stocktaking_bound_detail, 'column', created_time;
EXEC sp_addextendedproperty 'MS_Description', '更新人', 'SCHEMA', dbo, 'table', stocktaking_bound_detail, 'column', updated_by;
EXEC sp_addextendedproperty 'MS_Description', '更新时间', 'SCHEMA', dbo, 'table', stocktaking_bound_detail, 'column', updated_time;

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[store_early warning]') AND type in (N'U')) DROP TABLE [dbo].[store_early warning];
CREATE TABLE [dbo].[store_early warning](
    id VARCHAR(32) NOT NULL,
    tool_code VARCHAR(32) NOT NULL,
    tool_id VARCHAR(64),
    goods_shelves_id VARCHAR(32),
    lower_inventory DECIMAL(64),
    highest_inventory DECIMAL(64),
    total_count DECIMAL(64),
    available_quantity DECIMAL(64),
    status VARCHAR(255),
    remark VARCHAR(216),
    tenant_id VARCHAR,
    created_by VARCHAR(32),
    created_time DATETIME,
    updated_by VARCHAR(32),
    updated_time DATETIME,
    PRIMARY KEY (id)
);

EXEC sp_addextendedproperty 'MS_Description', '库存预警', 'SCHEMA', dbo, 'table', store_early warning, null, null;
EXEC sp_addextendedproperty 'MS_Description', '主键', 'SCHEMA', dbo, 'table', store_early warning, 'column', id;
EXEC sp_addextendedproperty 'MS_Description', '工具编码', 'SCHEMA', dbo, 'table', store_early warning, 'column', tool_code;
EXEC sp_addextendedproperty 'MS_Description', '工具编号', 'SCHEMA', dbo, 'table', store_early warning, 'column', tool_id;
EXEC sp_addextendedproperty 'MS_Description', '存储位置', 'SCHEMA', dbo, 'table', store_early warning, 'column', goods_shelves_id;
EXEC sp_addextendedproperty 'MS_Description', '库存下限', 'SCHEMA', dbo, 'table', store_early warning, 'column', lower_inventory;
EXEC sp_addextendedproperty 'MS_Description', '库存上限', 'SCHEMA', dbo, 'table', store_early warning, 'column', highest_inventory;
EXEC sp_addextendedproperty 'MS_Description', '总库存数量', 'SCHEMA', dbo, 'table', store_early warning, 'column', total_count;
EXEC sp_addextendedproperty 'MS_Description', '可用库存数量', 'SCHEMA', dbo, 'table', store_early warning, 'column', available_quantity;
EXEC sp_addextendedproperty 'MS_Description', '状态;1已处理；2.未处理。', 'SCHEMA', dbo, 'table', store_early warning, 'column', status;
EXEC sp_addextendedproperty 'MS_Description', '备注', 'SCHEMA', dbo, 'table', store_early warning, 'column', remark;
EXEC sp_addextendedproperty 'MS_Description', '租户号', 'SCHEMA', dbo, 'table', store_early warning, 'column', tenant_id;
EXEC sp_addextendedproperty 'MS_Description', '创建人', 'SCHEMA', dbo, 'table', store_early warning, 'column', created_by;
EXEC sp_addextendedproperty 'MS_Description', '创建时间', 'SCHEMA', dbo, 'table', store_early warning, 'column', created_time;
EXEC sp_addextendedproperty 'MS_Description', '更新人', 'SCHEMA', dbo, 'table', store_early warning, 'column', updated_by;
EXEC sp_addextendedproperty 'MS_Description', '更新时间', 'SCHEMA', dbo, 'table', store_early warning, 'column', updated_time;

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[goods_shelves_mark]') AND type in (N'U')) DROP TABLE [dbo].[goods_shelves_mark];
CREATE TABLE [dbo].[goods_shelves_mark](
    id VARCHAR(32) NOT NULL,
    warehouse_id VARCHAR(32) NOT NULL,
    goods_shelves VARCHAR(32) NOT NULL,
    storey VARCHAR(128) NOT NULL,
    variety VARCHAR(255),
    tenant_id VARCHAR,
    created_by VARCHAR(32),
    created_time DATETIME,
    updated_by VARCHAR(32),
    updated_time DATETIME,
    PRIMARY KEY (id)
);

EXEC sp_addextendedproperty 'MS_Description', '货架层排库存工具特征标注', 'SCHEMA', dbo, 'table', goods_shelves_mark, null, null;
EXEC sp_addextendedproperty 'MS_Description', '主键', 'SCHEMA', dbo, 'table', goods_shelves_mark, 'column', id;
EXEC sp_addextendedproperty 'MS_Description', '仓库编号', 'SCHEMA', dbo, 'table', goods_shelves_mark, 'column', warehouse_id;
EXEC sp_addextendedproperty 'MS_Description', '货架编号', 'SCHEMA', dbo, 'table', goods_shelves_mark, 'column', goods_shelves;
EXEC sp_addextendedproperty 'MS_Description', '层数信息', 'SCHEMA', dbo, 'table', goods_shelves_mark, 'column', storey;
EXEC sp_addextendedproperty 'MS_Description', '品种-标注存放刀具品种信息', 'SCHEMA', dbo, 'table', goods_shelves_mark, 'column', variety;
EXEC sp_addextendedproperty 'MS_Description', '租户号', 'SCHEMA', dbo, 'table', goods_shelves_mark, 'column', tenant_id;
EXEC sp_addextendedproperty 'MS_Description', '创建人', 'SCHEMA', dbo, 'table', goods_shelves_mark, 'column', created_by;
EXEC sp_addextendedproperty 'MS_Description', '创建时间', 'SCHEMA', dbo, 'table', goods_shelves_mark, 'column', created_time;
EXEC sp_addextendedproperty 'MS_Description', '更新人', 'SCHEMA', dbo, 'table', goods_shelves_mark, 'column', updated_by;
EXEC sp_addextendedproperty 'MS_Description', '更新时间', 'SCHEMA', dbo, 'table', goods_shelves_mark, 'column', updated_time;

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[tool_ledger]') AND type in (N'U')) DROP TABLE [dbo].[tool_ledger];
CREATE TABLE [dbo].[tool_ledger](
    id VARCHAR(32) NOT NULL,
    classify_id VARCHAR(32),
    tool_id VARCHAR(32),
    total_count VARCHAR(64),
    available_count VARCHAR(64),
    loss_count VARCHAR(64),
    repair_count VARCHAR(64),
    detection_count VARCHAR(64),
    lend_count VARCHAR(64),
    sharpening_count VARCHAR(64),
    tenant_id VARCHAR,
    create_by VARCHAR(32),
    create_time DATETIME,
    update_by VARCHAR(32),
    update_time DATETIME,
    PRIMARY KEY (id)
);

EXEC sp_addextendedproperty 'MS_Description', '工具台账数据表', 'SCHEMA', dbo, 'table', tool_ledger, null, null;
EXEC sp_addextendedproperty 'MS_Description', '主键', 'SCHEMA', dbo, 'table', tool_ledger, 'column', id;
EXEC sp_addextendedproperty 'MS_Description', '分类编码', 'SCHEMA', dbo, 'table', tool_ledger, 'column', classify_id;
EXEC sp_addextendedproperty 'MS_Description', '工具编码', 'SCHEMA', dbo, 'table', tool_ledger, 'column', tool_id;
EXEC sp_addextendedproperty 'MS_Description', '总库存', 'SCHEMA', dbo, 'table', tool_ledger, 'column', total_count;
EXEC sp_addextendedproperty 'MS_Description', '可用库存', 'SCHEMA', dbo, 'table', tool_ledger, 'column', available_count;
EXEC sp_addextendedproperty 'MS_Description', '总报损数量', 'SCHEMA', dbo, 'table', tool_ledger, 'column', loss_count;
EXEC sp_addextendedproperty 'MS_Description', '在修数量', 'SCHEMA', dbo, 'table', tool_ledger, 'column', repair_count;
EXEC sp_addextendedproperty 'MS_Description', '在检数量', 'SCHEMA', dbo, 'table', tool_ledger, 'column', detection_count;
EXEC sp_addextendedproperty 'MS_Description', '在借数量', 'SCHEMA', dbo, 'table', tool_ledger, 'column', lend_count;
EXEC sp_addextendedproperty 'MS_Description', '在磨数量', 'SCHEMA', dbo, 'table', tool_ledger, 'column', sharpening_count;
EXEC sp_addextendedproperty 'MS_Description', '租户号', 'SCHEMA', dbo, 'table', tool_ledger, 'column', tenant_id;
EXEC sp_addextendedproperty 'MS_Description', '创建人', 'SCHEMA', dbo, 'table', tool_ledger, 'column', create_by;
EXEC sp_addextendedproperty 'MS_Description', '创建时间', 'SCHEMA', dbo, 'table', tool_ledger, 'column', create_time;
EXEC sp_addextendedproperty 'MS_Description', '更新人', 'SCHEMA', dbo, 'table', tool_ledger, 'column', update_by;
EXEC sp_addextendedproperty 'MS_Description', '更新时间', 'SCHEMA', dbo, 'table', tool_ledger, 'column', update_time;

