#   字段新增   （表名，字段名，字段类型，修改方式（1：新增，2：修改，3：删除）

CREATE TABLE IF NOT EXISTS `device_inspect_task`
(
    `id`            int                                                           NOT NULL AUTO_INCREMENT,
    `orderId`       varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '任务单号',
    `planOrderIdFk` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '巡检计划单号（外键）',
    `deptCode`      varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '部门',
    `invCode`       varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '仓库',
    `code`          varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '资产编码',
    `status`        int                                                           NULL DEFAULT NULL COMMENT '状态',
    `type`          int                                                           NULL DEFAULT NULL COMMENT '类型',
    `inspectUser`   varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '巡检人',
    `remindTime`    datetime(0)                                                   NULL DEFAULT NULL COMMENT '提醒时间',
    `remark`        varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '巡检备注',
    `strartTime`    datetime(0)                                                   NULL DEFAULT NULL COMMENT '任务开始时间',
    `endTime`       datetime(0)                                                   NULL DEFAULT NULL COMMENT '任务结束时间',
    `createTime`    datetime(0)                                                   NULL DEFAULT NULL COMMENT '创建时间',
    `updateTime`    datetime(0)                                                   NULL DEFAULT NULL COMMENT '更新时间',
    `expectedTime`  datetime(0)                                                   NULL DEFAULT NULL COMMENT '预期结束时间',
    `repairType`    int                                                           NULL DEFAULT NULL COMMENT '报修类型',
    `level`         int                                                           NULL DEFAULT NULL COMMENT '紧急程度',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB
  CHARACTER SET = utf8mb4
  COLLATE = utf8mb4_0900_ai_ci
  ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for device_inspect_task_detail
-- ----------------------------
CREATE TABLE IF NOT EXISTS `device_inspect_task_detail`
(
    `id`             int                                                           NOT NULL AUTO_INCREMENT,
    `projectCode`    varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '巡检项目编码',
    `projectContent` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '巡检内容',
    `status`         int                                                           NULL DEFAULT NULL COMMENT '状态（1：未开始；2：已检查；3：异常；4：不巡检',
    `result`         varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '巡检结果备注',
    `inspectImage`   varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '巡检图片',
    `inspectUser`    varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '巡检人',
    `updateTime`     datetime(0)                                                   NULL DEFAULT NULL COMMENT '更新时间',
    `taskOrderIdFk`  varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '巡检任务ID外键',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB
  CHARACTER SET = utf8mb4
  COLLATE = utf8mb4_0900_ai_ci
  ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for device_project_set
-- ----------------------------
CREATE TABLE IF NOT EXISTS `device_project_set`
(
    `id`         int                                                           NOT NULL AUTO_INCREMENT,
    `code`       varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '项目编号',
    `content`    varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '项目内容',
    `type`       int                                                           NULL DEFAULT NULL COMMENT '项目类型：1：巡检；2：养护',
    `remak`      varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '备注',
    `udpateTime` datetime(0)                                                   NULL DEFAULT NULL COMMENT '更新时间',
    `updateUser` varchar(0) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci   NULL DEFAULT NULL COMMENT '更新人',
    `createUser` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '创建人',
    `createTime` datetime(0)                                                   NULL DEFAULT NULL COMMENT '创建时间',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB
  CHARACTER SET = utf8mb4
  COLLATE = utf8mb4_0900_ai_ci
  ROW_FORMAT = Dynamic;

SET FOREIGN_KEY_CHECKS = 1;


CALL Pro_Temp_ColumnWork('device_repair_order', 'repairType', 'tinyint', 1);
CALL Pro_Temp_ColumnWork('device_repair_order', 'urgencyType', 'tinyint', 1);
CALL Pro_Temp_ColumnWork('device_repair_order', 'planTime', 'datetime', 1);
CALL Pro_Temp_ColumnWork('device_repair_order', 'uploadImage', 'text', 1);
CALL Pro_Temp_ColumnWork('device_repair_order', 'repariName', 'varchar(255)', 1);
CALL Pro_Temp_ColumnWork('device_repair_order', 'reparistartTime', 'datetime', 1);
CALL Pro_Temp_ColumnWork('device_repair_order', 'repariEndTime', 'datetime', 1);
CALL Pro_Temp_ColumnWork('device_repair_order', 'repariRemark', 'varchar(255)', 1);
CALL Pro_Temp_ColumnWork('device_repair_order', 'repariImage', 'text', 1);

CALL Pro_Temp_ColumnWork('device_inspect_plan', 'startTime', 'datetime', 1);
CALL Pro_Temp_ColumnWork('device_inspect_plan', 'endTime', 'datetime', 1);
CALL Pro_Temp_ColumnWork('device_inspect_plan', 'frequency', 'varchar(255)', 1);
CALL Pro_Temp_ColumnWork('device_inspect_plan', 'frequencyUnit', 'tinyint', 1);
CALL Pro_Temp_ColumnWork('device_inspect_plan', 'planStatus', 'tinyint', 1);
CALL Pro_Temp_ColumnWork('device_inspect_plan', 'inspectUser', 'varchar(255)', 1);
CALL Pro_Temp_ColumnWork('device_inspect_plan', 'lastTime', 'datetime', 1);
CALL Pro_Temp_ColumnWork('device_inspect_plan', 'nextTime', 'datetime', 1);
INSERT ignore INTO `sys_param_config`(`id`, `parentId`, `paramName`, `paramKey`, `paramValue`, `paramStatus`,
                                      `paramType`, `paramExplain`, `updateTime`)
VALUES (2088, 0, '是否只校验批次号', 'only_vail_batch', '0', 0, 0, '是否只校验批次号(0：否；1：是)', NULL);

CALL Pro_Temp_ColumnWork('device_inspect_task', 'repairType', 'tinyint', 1);
CALL Pro_Temp_ColumnWork('device_inspect_task', 'level', 'tinyint', 1);


CALL Pro_Temp_ColumnWork('io_order', 'preInSelected', 'tinyint', 1);

#
# 	update  io_order set preInSelected = 1  WHERE io_order.billNo in (select checkPreInOrders from (select checkPreInOrders from  io_order  WHERE checkPreInOrders is not null GROUP BY checkPreInOrders) a) ;


CREATE TABLE IF NOT EXISTS `sync_edit_log`
(
    `id`         int                                                            NOT NULL AUTO_INCREMENT,
    `recordCode` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci  NULL DEFAULT NULL COMMENT '日志记录号',
    `operType`   tinyint                                                        NULL DEFAULT NULL COMMENT '操作类型（1:增；2:删，3:改，4:查)',
    `dataType`   varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci  NULL DEFAULT NULL COMMENT '操作数据类型',
    `url`        varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci  NULL DEFAULT NULL COMMENT '接口地址',
    `param`      varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '请求参数',
    `jsonResult` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci  NULL DEFAULT NULL COMMENT '请求结果',
    `directType` tinyint                                                        NULL DEFAULT NULL COMMENT '1:本地操作；2：对方操作',
    `remark`     varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci  NULL DEFAULT NULL COMMENT '备注说明',
    `operUser`   varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci  NULL DEFAULT NULL COMMENT '操作人',
    `updateTime` datetime(0)                                                    NULL DEFAULT NULL COMMENT '更新时间',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB
  CHARACTER SET = utf8mb4
  COLLATE = utf8mb4_0900_ai_ci
  ROW_FORMAT = Dynamic;


CREATE TABLE IF NOT EXISTS `sync_edit_type`
(
    `id`     int                                                           NOT NULL AUTO_INCREMENT,
    `code`   varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '操作类型',
    `name`   varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '操作类型名称',
    `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '备注',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB
  CHARACTER SET = utf8mb4
  COLLATE = utf8mb4_0900_ai_ci
  ROW_FORMAT = Dynamic;

SET FOREIGN_KEY_CHECKS = 1;


CREATE TABLE IF NOT EXISTS `device_repair_order_detail`
(
    `id`         bigint(0)                                                     NOT NULL,
    `orderIdFk`  varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
    `code`       varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '项目编号',
    `content`    varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '项目内容',
    `type`       int(0)                                                        NULL DEFAULT NULL COMMENT '项目类型：1：巡检；2：养护',
    `remark`     varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '备注',
    `updateUser` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '更新人',
    `updateTime` datetime(0)                                                   NULL DEFAULT NULL COMMENT '更新时间',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB
  CHARACTER SET = utf8mb4
  COLLATE = utf8mb4_0900_ai_ci
  ROW_FORMAT = Dynamic;


CREATE TABLE IF NOT EXISTS `device_inspect_plan_delect`
(
    `id`         bigint(0)                                                     NOT NULL,
    `orderIdFk`  varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
    `code`       varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '项目编号',
    `content`    varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '项目内容',
    `type`       int(0)                                                        NULL DEFAULT NULL COMMENT '项目类型：1：巡检；2：养护',
    `remark`     varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '备注',
    `updateUser` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '更新人',
    `updateTime` datetime(0)                                                   NULL DEFAULT NULL COMMENT '更新时间',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB
  CHARACTER SET = utf8mb4
  COLLATE = utf8mb4_0900_ai_ci
  ROW_FORMAT = Dynamic;



CALL Pro_Temp_ColumnWork('device_inspect_task', 'id', 'bigint', 2);
CALL Pro_Temp_ColumnWork('device_inspect_task_detail', 'id', 'bigint', 2);
CALL Pro_Temp_ColumnWork('sync_data_set', 'deviceTask', 'tinyint', 1);


# INSERT ignore INTO `auth_menu`(`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query_param`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (2000, '我的申购单 ', 1674, 2, 'purchase/purApply/pureApplyMySearch', 'purchase/purApply/pureApplyMySearch', NULL, 1, 0, 'C', '0', '0', NULL, NULL, '超级用户', '2023-07-20 17:08:38', NULL, NULL, NULL);
# INSERT ignore INTO `udi_wms_wmd`.`auth_menu`(`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query_param`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (2001, '我的领用单', 1685, 1, 'inout/receive/receiveMySearch', 'inout/receive/receiveMySearch', NULL, 1, 0, 'C', '0', '0', NULL, NULL, '超级用户', '2023-08-14 10:35:30', NULL, NULL, NULL);
#

INSERT ignore INTO `sys_param_config`(`id`, `parentId`, `paramName`, `paramKey`, `paramValue`, `paramStatus`,
                                      `paramType`, `paramExplain`, `updateTime`)
VALUES (20068, 0, '设备领用是否选取耗材字段', 'device_product', '0', 1, 0, '0：否；1：是', NULL);
INSERT ignore INTO `sys_pdf_template_relevance_label` (`id`, `templateId`, `customerId`, `adminId`, `moduleId`,
                                                       `localAction`, `remark1`, `remark2`, `remark3`, `printType`,
                                                       `modelKey`, `updateTime`)
VALUES (5, 3, 110, 0, 9, '设备打印', NULL, NULL, NULL, NULL, 'lable', '2023-06-25 15:18:37');



CREATE TABLE IF NOT EXISTS `device_asset_cert`
(
    `id`         bigint                                                        NOT NULL,
    `devCodeFk`  varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '设备资产编码外键',
    `name`       varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '证书名称',
    `code`       varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '证书编码',
    `filePath`   text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci         NULL COMMENT '文件路径',
    `vailDate`   datetime(0)                                                   NULL DEFAULT NULL COMMENT '生效期',
    `expireDate` datetime(0)                                                   NULL DEFAULT NULL COMMENT '失效期',
    `status`     tinyint                                                       NULL DEFAULT NULL COMMENT '证书状态',
    `type`       tinyint                                                       NULL DEFAULT NULL COMMENT '证书类型（1：资质证书；2：技术材料）',
    `remark`     varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '备注说明',
    `createUser` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '创建人',
    `createTime` datetime(0)                                                   NULL DEFAULT NULL COMMENT '创建时间',
    `updateUser` datetime(0)                                                   NULL DEFAULT NULL COMMENT '更新人',
    `updateTime` datetime(0)                                                   NULL DEFAULT NULL COMMENT '更新时间',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB
  CHARACTER SET = utf8mb4
  COLLATE = utf8mb4_0900_ai_ci
  ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Records of device_asset_cert
-- ----------------------------

SET FOREIGN_KEY_CHECKS = 1;


CREATE TABLE IF NOT EXISTS `device_asset_user`
(
    `id`         bigint                                                        NOT NULL COMMENT '雪花ID',
    `devCodeFk`  varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '设备资产编码',
    `userName`   varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '相关人员名称',
    `contact1`   varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '联系方式1',
    `contact2`   varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '联系方式2',
    `remark`     varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '备注说明',
    `createUser` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '创建人',
    `createTime` datetime(0)                                                   NULL DEFAULT NULL COMMENT '创建时间',
    `updateUser` varchar(0) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci   NULL DEFAULT NULL COMMENT '更新人',
    `updateTime` datetime(0)                                                   NULL DEFAULT NULL COMMENT '更新时间',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB
  CHARACTER SET = utf8mb4
  COLLATE = utf8mb4_0900_ai_ci
  ROW_FORMAT = Dynamic;


CREATE TABLE IF NOT EXISTS `device_asset_usage`
(
    `id`         bigint                                                        NOT NULL COMMENT '雪花ID',
    `code`       varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '使用记录号',
    `user`       varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '使用人',
    `startTime`  datetime(0)                                                   NULL DEFAULT NULL COMMENT '开始时间',
    `endTime`    datetime(0)                                                   NULL DEFAULT NULL COMMENT '结束时间',
    `remark`     varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '备注',
    `createUser` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '创建人',
    `createTime` datetime(0)                                                   NULL DEFAULT NULL COMMENT '创建时间',
    `updateUser` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '更新人',
    `updateTime` datetime(0)                                                   NULL DEFAULT NULL COMMENT '更新时间',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB
  CHARACTER SET = utf8mb4
  COLLATE = utf8mb4_0900_ai_ci
  ROW_FORMAT = Dynamic;


CALL Pro_Temp_ColumnWork('dept_device_detail', 'curUser', 'varchar(255)', 1);
CALL Pro_Temp_ColumnWork('dept_device_detail', 'location', 'varchar(255)', 1);
CALL Pro_Temp_ColumnWork('dept_device_detail', 'detailLocation', 'varchar(255)', 1);
CALL Pro_Temp_ColumnWork('dept_device_detail', 'nameCode', 'varchar(255)', 1);

CALL Pro_Temp_ColumnWork('device_inspect_plan', 'executeCount', 'int', 1);
CALL Pro_Temp_ColumnWork('device_inspect_plan', 'useFrequency', 'int', 1);

CALL Pro_Temp_ColumnWork('device_receive_order', 'type', 'int', 1);


INSERT ignore INTO `sys_param_config`(`id`, `parentId`, `paramName`, `paramKey`, `paramValue`, `paramStatus`,
                                      `paramType`, `paramExplain`, `updateTime`)
VALUES (2090, 0, '更新第三方产品信息是否选入耗材字典', 'update_third_in_rel', '0', 0, 0, '更新第三方产品信息是否选入耗材字典(0：否；1：是)', NULL);

CALL Pro_Temp_ColumnWork('basic_bussiness_type', 'checkWebNewType', 'tinyint', 1);

CALL Pro_Temp_ColumnWork('device_repair_order', 'inspectUser', 'varchar(255)', 1);

CALL Pro_Temp_ColumnWork('inv_product_detail', 'price', 'decimal(10, 2)', 1);
CALL Pro_Temp_ColumnWork('inv_pre_product_detail', 'price', 'decimal(10, 2)', 1);
CALL Pro_Temp_ColumnWork('inv_prein_product_detail', 'price', 'decimal(10, 2)', 1);

CALL Pro_Temp_ColumnWork('inv_product_detail', 'outFlag', 'tinyint', 1);
CALL Pro_Temp_ColumnWork('inv_pre_product_detail', 'outFlag', 'tinyint', 1);
CALL Pro_Temp_ColumnWork('inv_prein_product_detail', 'outFlag', 'tinyint', 1);


#   字段新增   （表名，字段名，字段类型，修改方式（1：新增，2：修改，3：删除）

CALL Pro_Temp_ColumnWork('thr_products', 'manufactoryCode',
                         'varchar(255) ', 1);
CALL Pro_Temp_ColumnWork('thr_products', 'supCode',
                         'varchar(255) ', 1);

CALL Pro_Temp_ColumnWork('basic_download_status', 'cacheFilePath',
                         'varchar(255) ', 1);

CALL Pro_Temp_ColumnWork('auth_user_bustype', 'updateTime',
                         'datetime ', 1);
CALL Pro_Temp_ColumnWork('auth_warehouse_bustype', 'updateTime',
                         'datetime ', 1);
CALL Pro_Temp_ColumnWork('auth_warehouse_user', 'updateTime',
                         'datetime ', 1);
CALL Pro_Temp_ColumnWork('auth_dept_user', 'updateTime',
                         'datetime ', 1);

CALL Pro_Temp_ColumnWork('sync_data_set', 'department', 'tinyint ', 1);
CALL Pro_Temp_ColumnWork('sync_data_set', 'warehouseDict', 'tinyint ', 1);
CALL Pro_Temp_ColumnWork('sync_data_set', 'userData', 'tinyint ', 1);

CALL Pro_Temp_ColumnWork('io_order', 'fromReceiveBillNo', 'varchar(255) ', 1);
CALL Pro_Temp_ColumnWork('io_order', 'fromThrBillNo', 'varchar(255) ', 1);
CALL Pro_Temp_ColumnWork('io_order', 'syncStatus', 'tinyint ', 1);
CALL Pro_Temp_ColumnWork('io_order', 'busType', 'tinyint ', 1);
CALL Pro_Temp_ColumnWork('io_order', 'deliveryStatus', 'tinyint ', 1);
CALL Pro_Temp_ColumnWork('io_order', 'inCodeStatus', 'tinyint ', 1);
CALL Pro_Temp_ColumnWork('io_order', 'processStatus', 'tinyint ', 1);

CALL Pro_Temp_ColumnWork('io_order', 'suppleCount', 'tinyint ', 1);
CALL Pro_Temp_ColumnWork('io_order', 'relKey', 'varchar(255) ', 1);
CALL Pro_Temp_ColumnWork('io_order', 'checkTime', 'datetime ', 1);
CALL Pro_Temp_ColumnWork('io_order', 'checkUser', 'varchar(255) ', 1);


CALL Pro_Temp_ColumnWork('io_code_lost', 'nameCode', 'varchar(255) ', 1);

CALL Pro_Temp_ColumnWork('thr_bustype_origin', 'thirdSysName', 'varchar(255) ', 3);
CALL Pro_Temp_ColumnWork('thr_system_bus_api', 'thirdBuyName', 'varchar(255) ', 3);

CALL Pro_Temp_ColumnWork('io_order_detail_biz', 'bindRlIds', 'varchar(255) ', 1);
CALL Pro_Temp_ColumnWork('io_order_detail_biz', 'checkFileName', 'varchar(255) ', 1);


CALL Pro_Temp_ColumnWork('io_order_detail_biz', 'coldFilePath', 'varchar(255)', 1);

CALL Pro_Temp_ColumnWork('io_order_detail_biz', 'checkColdFileName', 'varchar(255)', 1);

CALL Pro_Temp_ColumnWork('io_order_invoice', 'bizIdFk', 'int ', 1);

CALL Pro_Temp_ColumnWork('thr_products', 'updateUser', 'varchar(255)  ', 1);
CALL Pro_Temp_ColumnWork('thr_products', 'createUser', 'varchar(255)  ', 1);
CALL Pro_Temp_ColumnWork('thr_products', 'createTime', 'varchar(255)  ', 1);



CALL Pro_Temp_ColumnWork('auth_warehouse', 'advanceType', 'tinyint', 1);
CALL Pro_Temp_ColumnWork('auth_warehouse', 'spUse', 'tinyint', 1);


CALL Pro_Temp_ColumnWork('basic_udirel', 'relCode', 'varchar(255) ', 1);
CALL Pro_Temp_ColumnWork('basic_udirel', 'lowStockNum', 'varchar(255) ', 1);
CALL Pro_Temp_ColumnWork('basic_udirel', 'useExpireTime', 'int', 1);
CALL Pro_Temp_ColumnWork('basic_udirel', 'dispatch', 'tinyint', 1);
CALL Pro_Temp_ColumnWork('basic_udirel', 'groupBuy', 'tinyint', 1);
CALL Pro_Temp_ColumnWork('basic_udirel', 'isDateBy', 'tinyint', 1);
CALL Pro_Temp_ColumnWork('basic_udirel', 'needCert', 'tinyint', 1);
CALL Pro_Temp_ColumnWork('basic_udirel', 'certIdFk', 'varchar(255)', 1);


CALL Pro_Temp_ColumnWork('basic_products', 'allowNoSerial', 'tinyint', 1);


CALL Pro_Temp_ColumnWork('basic_bussiness_type', 'vailDispatch', 'tinyint', 1);
CALL Pro_Temp_ColumnWork('basic_bussiness_type', 'vailGroupBuy', 'tinyint', 1);
CALL Pro_Temp_ColumnWork('basic_bussiness_type', 'busType', 'tinyint', 1);
CALL Pro_Temp_ColumnWork('basic_bussiness_type', 'inStock', 'tinyint', 1);
CALL Pro_Temp_ColumnWork('basic_bussiness_type', 'actionType', 'tinyint', 1);

CALL Pro_Temp_ColumnWork('basic_bussiness_type', 'thrCheckEnable', 'tinyint', 1);
CALL Pro_Temp_ColumnWork('basic_bussiness_type', 'thrCheckWebNew', 'tinyint', 1);
CALL Pro_Temp_ColumnWork('basic_bussiness_type', 'thrCheckPdaUn', 'tinyint', 1);
CALL Pro_Temp_ColumnWork('basic_bussiness_type', 'thrCheckPdaEd', 'tinyint', 1);
CALL Pro_Temp_ColumnWork('basic_bussiness_type', 'thrCheckUdims', 'tinyint', 1);
CALL Pro_Temp_ColumnWork('basic_bussiness_type', 'thrCheckPc', 'tinyint', 1);
CALL Pro_Temp_ColumnWork('basic_bussiness_type', 'thrCheckSp', 'tinyint', 1);
CALL Pro_Temp_ColumnWork('basic_bussiness_type', 'thrCheckChange', 'tinyint', 1);
CALL Pro_Temp_ColumnWork('basic_bussiness_type', 'thrCheckBalance', 'tinyint', 1);
CALL Pro_Temp_ColumnWork('basic_bussiness_type', 'thrCheckCopy', 'tinyint', 1);
CALL Pro_Temp_ColumnWork('basic_bussiness_type', 'fillCodeRel', 'tinyint', 1);
CALL Pro_Temp_ColumnWork('basic_bussiness_type', 'checkVailDate', 'tinyint', 1);
CALL Pro_Temp_ColumnWork('basic_bussiness_type', 'checkExpire', 'tinyint', 1);
CALL Pro_Temp_ColumnWork('basic_bussiness_type', 'checkCertExpire', 'tinyint', 1);
CALL Pro_Temp_ColumnWork('basic_bussiness_type', 'preInBackAction', 'varchar(255) ', 1);
CALL Pro_Temp_ColumnWork('basic_bussiness_type', 'backPreinType', 'tinyint', 1);



CALL Pro_Temp_ColumnWork('pur_delivery_detail', 'batchNo', 'varchar(255) ', 1);
CALL Pro_Temp_ColumnWork('pur_delivery_detail', 'productDate', 'varchar(255) ', 1);
CALL Pro_Temp_ColumnWork('pur_delivery_detail', 'expireDate', 'varchar(255) ', 1);

CALL Pro_Temp_ColumnWork('pur_arrival_detail', 'batchNo', 'varchar(255) ', 1);
CALL Pro_Temp_ColumnWork('pur_arrival_detail', 'productDate', 'varchar(255) ', 1);
CALL Pro_Temp_ColumnWork('pur_arrival_detail', 'expireDate', 'varchar(255) ', 1);
CALL Pro_Temp_ColumnWork('pur_arrival_detail', 'arrivalCount', 'int ', 1);
CALL Pro_Temp_ColumnWork('pur_arrival', 'supId', 'varchar(255) ', 1);

CALL Pro_Temp_ColumnWork('pur_returned_detail', 'batchNo', 'varchar(255) ', 1);
CALL Pro_Temp_ColumnWork('pur_returned_detail', 'productDate', 'varchar(255) ', 1);
CALL Pro_Temp_ColumnWork('pur_returned_detail', 'expireDate', 'varchar(255) ', 1);


CALL Pro_Temp_ColumnWork('pur_delivery', 'supId', 'varchar(255) ', 1);
CALL Pro_Temp_ColumnWork('pur_returned', 'supId', 'varchar(255) ', 1);


CALL Pro_Temp_ColumnWork('basic_bustype_pre', 'targetBusAction', 'varchar(255)', 1);
CALL Pro_Temp_ColumnWork('basic_bustype_pre', 'busBeforeTime', 'tinyint', 1);
CALL Pro_Temp_ColumnWork('basic_bustype_pre', 'beforeTime', 'tinyint', 1);
CALL Pro_Temp_ColumnWork('basic_bustype_pre', 'auditStatus', 'tinyint', 1);
CALL Pro_Temp_ColumnWork('basic_bustype_pre', 'busAuditStatus', 'tinyint', 1);

CALL Pro_Temp_ColumnWork('basic_bustype_change', 'auditStatus', 'tinyint', 1);
CALL Pro_Temp_ColumnWork('basic_bustype_change', 'busAuditStatus', 'tinyint', 1);
CALL Pro_Temp_ColumnWork('basic_bustype_change', 'targetBusAction', 'varchar(255)', 1);
CALL Pro_Temp_ColumnWork('basic_bustype_change', 'beforeTime', 'tinyint', 1);
CALL Pro_Temp_ColumnWork('basic_bustype_change', 'busBeforeTime', 'tinyint', 1);

CALL Pro_Temp_ColumnWork('pur_order', 'emergency', 'varchar(255)', 1);
CALL Pro_Temp_ColumnWork('pur_order', 'supId', 'varchar(255)', 1);
CALL Pro_Temp_ColumnWork('pur_order', 'arrivalTime', 'datetime', 1);
CALL Pro_Temp_ColumnWork('pur_order', 'dealStatus', 'int', 1);

CALL Pro_Temp_ColumnWork('pur_plan', 'applyInv', 'varchar(255)', 1);
CALL Pro_Temp_ColumnWork('pur_order', 'applyInv', 'varchar(255)', 1);

INSERT ignore INTO `auth_warehouse`(`id`, `code`, `name`, `parentId`, `remark`, `defaultInv`, `thirdId`, `thirdId1`,
                                    `thirdId2`, `thirdId3`, `thirdId4`, `parentCode`, `advanceType`, `spUse`)
VALUES ('1541070754823692288', '1000000', '总库', '1000', '总111111', 0, '1001304', '402', NULL, NULL, NULL, '', 1, 1);
INSERT ignore INTO `auth_warehouse`(`id`, `code`, `name`, `parentId`, `remark`, `defaultInv`, `thirdId`, `thirdId1`,
                                    `thirdId2`, `thirdId3`, `thirdId4`, `parentCode`, `advanceType`, `spUse`)
VALUES ('1541070754823692289', '1000002', '寄售库', '1000', '总111111', 0, '1001304', '402', NULL, NULL, NULL, '', 2,
        1);
INSERT ignore INTO `auth_warehouse`(`id`, `code`, `name`, `parentId`, `remark`, `defaultInv`, `thirdId`, `thirdId1`,
                                    `thirdId2`, `thirdId3`, `thirdId4`, `parentCode`, `advanceType`, `spUse`)
VALUES ('1541070754823692290', '1000001', '预验收库', '1000', '总111111', 0, '1001304', '402', NULL, NULL, NULL, '', 3,
        1);


CALL Pro_Temp_ColumnWork('pur_order_detail', 'planCount', 'tinyint', 1);

CALL Pro_Temp_ColumnWork('inv_prein_detail', 'status', 'tinyint', 1);
CALL Pro_Temp_ColumnWork('inv_prein_detail', 'originCount', 'int', 1);
CALL Pro_Temp_ColumnWork('inv_prein_detail', 'originReCount', 'int', 1);

CALL Pro_Temp_ColumnWork('inv_prein_detail', 'mainAction', 'varchar(255)', 1);
CALL Pro_Temp_ColumnWork('inv_prein_detail', 'action', 'varchar(255)', 1);

CALL Pro_Temp_ColumnWork('io_code_lost', 'nameCode', 'varchar(255)', 1);

INSERT ignore INTO `sys_param_config`(`id`, `parentId`, `paramName`, `paramKey`, `paramValue`, `paramStatus`,
                                      `paramType`, `paramExplain`)
VALUES (20040, 0, '允许送货单直接入库变更库存', 'deliveryInstock', '0', 1, 0, '0：否；1：是');

CALL Pro_Temp_ColumnWork('sup_product', 'manufactory', 'varchar(255)', 1);
CALL Pro_Temp_ColumnWork('sup_product', 'allowNoBatch', 'tinyint', 1);
CALL Pro_Temp_ColumnWork('sup_product', 'allowNoExpire', 'tinyint', 1);
CALL Pro_Temp_ColumnWork('sup_product', 'allowNoProduct', 'tinyint', 1);
CALL Pro_Temp_ColumnWork('sup_product', 'allowNoSerial', 'tinyint', 1);

CALL Pro_Temp_ColumnWork('inv_remind_msg', 'remindCount', 'int', 1);
CALL Pro_Temp_ColumnWork('inv_remind_set', 'status', 'tinyint', 1);
CALL Pro_Temp_ColumnWork('sup_cert_remind_msg', 'remindCount', 'int', 1);

CALL Pro_Temp_ColumnWork('sync_data_bustypes', 'orderStatus', 'tinyint', 1);
CALL Pro_Temp_ColumnWork('sync_data_bustypes', 'direct', 'tinyint', 1);


CALL Pro_Temp_ColumnWork('sup_manufacturer', 'agentName', 'varchar(255)', 1);
CALL Pro_Temp_ColumnWork('sys_pdf_module', 'modelKey', 'varchar(255)', 1);
CALL Pro_Temp_ColumnWork('sys_pdf_template', 'bussinessType', 'varchar(255)', 1);
CALL Pro_Temp_ColumnWork('sys_pdf_template', 'bussinessStatus', 'varchar(255)', 1);

CALL Pro_Temp_ColumnWork('io_order_detail_biz', 'filePath', 'varchar(255)', 1);

CALL Pro_Temp_ColumnWork('io_order', 'checkStatus', 'tinyint', 1);

INSERT ignore INTO `sys_scheduled`(`id`, `cronName`, `cron`, `customerId`, `remark`)
VALUES (100, 'clean_log_task', '0 0 2 1/1 * ? ', NULL, '删除日志数据');



CALL Pro_Temp_ColumnWork('inv_product', 'nowStock', 'int ', 1);
CALL Pro_Temp_ColumnWork('inv_product', 'frozenCount', 'int ', 1);
CALL Pro_Temp_ColumnWork('inv_product', 'planInCount', 'int ', 1);
CALL Pro_Temp_ColumnWork('inv_product', 'planOutCount', 'int ', 1);
CALL Pro_Temp_ColumnWork('inv_product', 'onWayCount', 'int ', 1);
CALL Pro_Temp_ColumnWork('inv_product', 'availableStock', 'int ', 1);

CALL Pro_Temp_ColumnWork('inv_product_detail', 'inCount', 'int ', 1);
CALL Pro_Temp_ColumnWork('inv_product_detail', 'outCount', 'int ', 1);
CALL Pro_Temp_ColumnWork('inv_prein_product_detail', 'inCount', 'int ', 1);
CALL Pro_Temp_ColumnWork('inv_prein_product_detail', 'outCount', 'int ', 1);
CALL Pro_Temp_ColumnWork('inv_pre_product_detail', 'inCount', 'int ', 1);
CALL Pro_Temp_ColumnWork('inv_pre_product_detail', 'outCount', 'int ', 1);

CALL Pro_Temp_ColumnWork('auth_warehouse', 'updateTime', 'datetime ', 1);

CALL Pro_Temp_ColumnWork('sync_data_set', 'basicType', 'tinyint', 1);
CALL Pro_Temp_ColumnWork('sync_data_set', 'basicDept', 'tinyint', 1);
CALL Pro_Temp_ColumnWork('sync_data_set', 'dbDiCompany', 'tinyint', 1);

CALL Pro_Temp_ColumnWork('sync_data_set', 'updateTime', 'datetime', 1);

CALL Pro_Temp_ColumnWork('sync_data_set', 'orderToInSyncTime', 'int', 1);
CALL Pro_Temp_ColumnWork('sync_data_set', 'supCert', 'tinyint', 1);
CALL Pro_Temp_ColumnWork('sync_data_set', 'systemConfig', 'tinyint', 1);
CALL Pro_Temp_ColumnWork('sync_data_set', 'printConfig', 'tinyint', 1);
CALL Pro_Temp_ColumnWork('sync_data_set', 'scanChangeConfig', 'tinyint', 1);
CALL Pro_Temp_ColumnWork('sync_data_set', 'busChangeConfig', 'tinyint', 1);
CALL Pro_Temp_ColumnWork('sync_data_set', 'basicThirdDept', 'tinyint', 1);
CALL Pro_Temp_ColumnWork('thr_inv_warehouse', 'updateTime', 'datetime', 1);
CALL Pro_Temp_ColumnWork('sys_param_config', 'updateTime', 'datetime', 1);
CALL Pro_Temp_ColumnWork('sys_pdf_template_relevance_code', 'updateTime', 'datetime', 1);
CALL Pro_Temp_ColumnWork('sys_pdf_template_relevance_biz', 'updateTime', 'datetime', 1);
CALL Pro_Temp_ColumnWork('sys_pdf_template_relevance_label', 'updateTime', 'datetime', 1);
CALL Pro_Temp_ColumnWork('sys_pdf_template_relevance_statemen', 'updateTime', 'datetime', 1);

CALL Pro_Temp_ColumnWork('thr_system_detail', 'time', 'int(5)', 1);


CALL Pro_Temp_ColumnWork('basic_bussiness_type', 'advancePreIn', 'tinyint', 1);
CALL Pro_Temp_ColumnWork('basic_bussiness_type', 'sortNum', 'int', 1);
CALL Pro_Temp_ColumnWork('basic_bussiness_type', 'preInBackAction', 'varchar(255) ', 1);
CALL Pro_Temp_ColumnWork('basic_bussiness_type', 'backPreinType', 'tinyint', 1);
CALL Pro_Temp_ColumnWork('io_order', 'checkPreInOrders', 'varchar(255)', 1);
CALL Pro_Temp_ColumnWork('io_order', 'checkPreInSpaceCode', 'varchar(255)', 1);
CALL Pro_Temp_ColumnWork('io_order', 'checkPreInInvCode', 'varchar(255)', 1);

CALL Pro_Temp_ColumnWork('sys_hosp_config', 'thirdSys', 'varchar(255)', 1);

# CALL Pro_Temp_ColumnWork('sup_cert_set', 'foreign', 'tinyint', 3);
# CALL Pro_Temp_ColumnWork('sup_cert_set', 'needForeign', 'tinyint', 1);

CALL Pro_Temp_ColumnWork('sync_data_set', 'udiCodeLost', 'tinyint ', 1);
CALL Pro_Temp_ColumnWork('sync_data_set', 'udiCodeRel', 'tinyint ', 1);


CALL Pro_Temp_ColumnWork('thr_order', 'inoutType', 'tinyint', 1);
CALL Pro_Temp_ColumnWork('thr_order', 'deptCode', 'varchar(255)', 1);
CALL Pro_Temp_ColumnWork('thr_order', 'invCode', 'varchar(255)', 1);
CALL Pro_Temp_ColumnWork('thr_order', 'reviewTime', 'datetime', 1);
CALL Pro_Temp_ColumnWork('thr_order_detail', 'supId', 'varchar(255)', 1);
CALL Pro_Temp_ColumnWork('thr_order_detail', 'supName', 'varchar(255)', 1);


CREATE TABLE IF NOT EXISTS `inv_prein_product`
(
    `id`             int                                                           NOT NULL AUTO_INCREMENT,
    `relIdFk`        bigint                                                        NULL DEFAULT NULL COMMENT '耗材字典ID',
    `nameCode`       varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '最小销售标识',
    `batchNo`        varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '批次号',
    `productionDate` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '生产日期',
    `expireDate`     varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '失效日期',
    `inCount`        int                                                           NULL DEFAULT NULL COMMENT '入库数量',
    `outCount`       int                                                           NULL DEFAULT NULL COMMENT '出库数量',
    `reCount`        varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '实际数量',
    `customerId`     varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '客户ID',
    `supId`          varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '供应商ID',
    `deptCode`       varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '部门编码',
    `invCode`        varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '仓库编码',
    `createTime`     datetime(0)                                                   NULL DEFAULT NULL COMMENT '创建时间',
    `updateTime`     datetime(0)                                                   NULL DEFAULT NULL COMMENT '更新时间',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB
  CHARACTER SET = utf8mb4
  COLLATE = utf8mb4_0900_ai_ci COMMENT = '预验收库存表'
  ROW_FORMAT = DYNAMIC;

SET FOREIGN_KEY_CHECKS = 1;



CREATE TABLE IF NOT EXISTS `inv_prein_product_detail`
(
    `id`           int                                                           NOT NULL AUTO_INCREMENT,
    `code`         varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT 'UDI码',
    `mainAction`   varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '出入单据类型',
    `action`       varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '单据类型',
    `orderId`      varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '订单号外键',
    `relId`        int                                                           NOT NULL COMMENT '耗材字典ID',
    `nameCode`     varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '最小销售标识',
    `batchNo`      varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '批次号',
    `produceDate`  varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '生产日期',
    `expireDate`   varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '失效日期',
    `serialNo`     varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '序列号',
    `supId`        varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '供应商',
    `count`        int                                                           NULL DEFAULT NULL COMMENT '扫码数量',
    `reCount`      int                                                           NULL DEFAULT NULL COMMENT '实际数量',
    `deptCode`     varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '部门编码',
    `invCode`      varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '仓库编码',
    `invSpaceCode` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '货位编码',
    `purchaseType` tinyint                                                       NULL DEFAULT NULL COMMENT '采购类型',
    `updateTime`   datetime(0)                                                   NULL DEFAULT NULL COMMENT '更新时间',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB
  CHARACTER SET = utf8mb4
  COLLATE = utf8mb4_0900_ai_ci COMMENT = '预验收库存详情表'
  ROW_FORMAT = DYNAMIC;


CREATE TABLE IF NOT EXISTS `sync_data_change_bustypes`
(
    `id`          int                                                           NOT NULL AUTO_INCREMENT,
    `action`      varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
    `name`        varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
    `outChange`   tinyint                                                       NULL DEFAULT NULL,
    `orderStatus` tinyint                                                       NULL DEFAULT NULL,
    PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB
  AUTO_INCREMENT = 128
  CHARACTER SET = utf8mb4
  COLLATE = utf8mb4_0900_ai_ci COMMENT = '单据同步 - 业务单据类型'
  ROW_FORMAT = DYNAMIC;

# 修改主键为LONG
CALL Pro_Temp_ColumnWork('basic_hosp_type', 'id', 'bigint', 2);
CALL Pro_Temp_ColumnWork('basic_udirel', 'id', 'bigint', 2);
CALL Pro_Temp_ColumnWork('basic_products', 'id', 'bigint', 2);
CALL Pro_Temp_ColumnWork('company_product_relevance', 'id', 'bigint', 2);

CALL Pro_Temp_ColumnWork('basic_corp', 'id', 'bigint', 2);


CALL Pro_Temp_ColumnWork('sup_cert', 'id', 'bigint', 2);
CALL Pro_Temp_ColumnWork('sup_cert_set', 'id', 'bigint', 2);
CALL Pro_Temp_ColumnWork('sup_company', 'id', 'bigint', 2);
CALL Pro_Temp_ColumnWork('sup_manufacturer', 'id', 'bigint', 2);
CALL Pro_Temp_ColumnWork('sup_product', 'id', 'bigint', 2);


CALL Pro_Temp_ColumnWork('io_code_lost', 'id', 'bigint', 2);
CALL Pro_Temp_ColumnWork('io_code_rel', 'id', 'bigint', 2);

CALL Pro_Temp_ColumnWork('basic_bussiness_type', 'id', 'bigint', 2);
CALL Pro_Temp_ColumnWork('basic_bustype_change', 'id', 'bigint', 2);
CALL Pro_Temp_ColumnWork('thr_bustype_origin', 'id', 'bigint', 2);


CALL Pro_Temp_ColumnWork('auth_user', 'id', 'bigint', 2);
CALL Pro_Temp_ColumnWork('auth_user_bustype', 'id', 'bigint', 2);
CALL Pro_Temp_ColumnWork('auth_user_bustype', 'userId', 'bigint', 2);
CALL Pro_Temp_ColumnWork('auth_dept', 'id', 'bigint', 2);
CALL Pro_Temp_ColumnWork('auth_dept', 'pid', 'bigint', 2);

CALL Pro_Temp_ColumnWork('auth_warehouse', 'id', 'bigint', 2);
CALL Pro_Temp_ColumnWork('auth_warehouse_bustype', 'id', 'bigint', 2);
CALL Pro_Temp_ColumnWork('auth_warehouse_user', 'id', 'bigint', 2);
CALL Pro_Temp_ColumnWork('auth_space', 'id', 'bigint', 2);


CALL Pro_Temp_ColumnWork('pur_apply', 'billType', 'varchar(255)', 2);



CREATE TABLE IF NOT EXISTS `inv_place_order`
(
    `id`         int                                                           NOT NULL AUTO_INCREMENT,
    `recordId`   varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '上架记录号',
    `type`       tinyint                                                       NULL DEFAULT NULL COMMENT '上架方式 1：按物资上架  2：按单上架',
    `orderId`    varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '单据号',
    `createUser` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '操作人',
    `createTime` datetime                                                      NULL DEFAULT NULL COMMENT '上架时间',
    `updateTime` datetime                                                      NULL DEFAULT NULL COMMENT '更新时间',
    `remark`     varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '备注',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB
  CHARACTER SET = utf8mb4
  COLLATE = utf8mb4_0900_ai_ci COMMENT = '上架记录表'
  ROW_FORMAT = Dynamic;

CREATE TABLE IF NOT EXISTS `inv_place_order_detail`
(
    `id`           int                                                           NOT NULL AUTO_INCREMENT,
    `recordId`     varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '上架记录号',
    `invCode`      varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '仓库号',
    `invSpaceCode` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '货位号',
    `code`         varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT 'UDI码',
    `relId`        varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '物资编码',
    `batchNo`      varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '批次号',
    `count`        int                                                           NULL DEFAULT NULL COMMENT '数量',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB
  CHARACTER SET = utf8mb4
  COLLATE = utf8mb4_0900_ai_ci COMMENT = '上架记录详情表'
  ROW_FORMAT = Dynamic;

SET FOREIGN_KEY_CHECKS = 1;


CALL Pro_Temp_ColumnWork('thr_dept', 'id', 'bigint', 2);
CALL Pro_Temp_ColumnWork('thr_inv_warehouse', 'id', 'bigint', 2);
CALL Pro_Temp_ColumnWork('thr_products', 'id', 'bigint', 2);
CALL Pro_Temp_ColumnWork('thr_corp', 'id', 'bigint', 2);



CALL Pro_Temp_ColumnWork('auth_dept_user', 'userId', 'bigint', 2);
CALL Pro_Temp_ColumnWork('auth_dept_user', 'deptId', 'bigint', 2);
CALL Pro_Temp_ColumnWork('basic_bustype_pre', 'Id', 'bigint', 2);
CALL Pro_Temp_ColumnWork('basic_export_status', 'remark', 'varchar(2048)', 2);
CALL Pro_Temp_ColumnWork('sup_cert', 'filePath', 'text', 2);
CALL Pro_Temp_ColumnWork('sync_data_bustypes', 'id', 'bigint', 2);
CALL Pro_Temp_ColumnWork('io_order_invoice', 'id', 'bigint ', 2);
CALL Pro_Temp_ColumnWork('sync_data_set', 'orderInvoice', 'tinyint', 1);

CALL Pro_Temp_ColumnWork('io_order', 'regStatus', 'tinyint', 1);
CALL Pro_Temp_ColumnWork('io_order', 'reviewSp', 'tinyint', 1);

-- CALL Pro_Temp_ColumnWork('io_order_detail_biz', 'regStatus', 'tinyint', 1);
CALL Pro_Temp_ColumnWork('io_order_detail_code', 'regStatus', 'varchar(255) ', 1);


CALL Pro_Temp_ColumnWork('inv_place_order', 'count', 'int', 1);
CALL Pro_Temp_ColumnWork('inv_place_order', 'id', 'bigint', 2);
CALL Pro_Temp_ColumnWork('inv_place_order_detail', 'id', 'bigint', 2);
CALL Pro_Temp_ColumnWork('inv_place_order_detail', 'nameCode', 'varchar(255)', 1);
CALL Pro_Temp_ColumnWork('inv_place_order_detail', 'supId', 'varchar(255)', 1);
CALL Pro_Temp_ColumnWork('inv_place_order_detail', 'expireDate', 'varchar(255)', 1);
CALL Pro_Temp_ColumnWork('inv_place_order_detail', 'produceDate', 'varchar(255)', 1);
CALL Pro_Temp_ColumnWork('inv_place_order_detail', 'serialNo', 'varchar(255)', 1);
CALL Pro_Temp_ColumnWork('sync_data_bustypes', 'syncStatus', 'tinyint', 1);
CALL Pro_Temp_ColumnWork('sync_data_bustypes', 'syncChange', 'tinyint', 1);
CALL Pro_Temp_ColumnWork('basic_bussiness_type', 'spaceOut', 'tinyint', 1);


CALL Pro_Temp_ColumnWork('io_order_detail_code', 'id', 'bigint ', 2);
CALL Pro_Temp_ColumnWork('io_order_detail_biz', 'id', 'bigint ', 2);
CALL Pro_Temp_ColumnWork('io_order_invoice', 'bizIdFk', 'bigint ', 2);

CALL Pro_Temp_ColumnWork('io_order', 'curSpaceCode', 'varchar(255)', 1);
CALL Pro_Temp_ColumnWork('io_order', 'preCurSpaceCode', 'varchar(255)', 1);
CALL Pro_Temp_ColumnWork('io_code_temp', 'preSpaceCode', 'varchar(255)', 1);
CALL Pro_Temp_ColumnWork('io_code_temp', 'preInSpaceCode', 'varchar(255)', 1);

CALL Pro_Temp_ColumnWork('io_code', 'preSpaceCode', 'varchar(255)', 1);
CALL Pro_Temp_ColumnWork('io_code', 'preInSpaceCode', 'varchar(255)', 1);


CALL Pro_Temp_ColumnWork('pur_order_detail', 'price', 'decimal(10, 2)', 1);

INSERT ignore INTO `sys_pdf_template_relevance_label`(`id`, `templateId`, `customerId`, `adminId`, `moduleId`,
                                                      `localAction`, `remark1`, `remark2`, `remark3`, `printType`,
                                                      `modelKey`)
VALUES (1, 30, 110, 0, 9, '内部码打印', NULL, NULL, NULL, NULL, 'lable');
INSERT ignore INTO `sys_pdf_template_relevance_statemen`(`id`, `templateId`, `customerId`, `adminId`, `moduleId`,
                                                         `localAction`, `remark1`, `remark2`, `remark3`, `printType`,
                                                         `modelKey`)
VALUES (1, 31, 110, 0, NULL, '配送企业资质打印', NULL, NULL, NULL, NULL, 'reportForms');
INSERT ignore INTO `sys_pdf_template_relevance_statemen`(`id`, `templateId`, `customerId`, `adminId`, `moduleId`,
                                                         `localAction`, `remark1`, `remark2`, `remark3`, `printType`,
                                                         `modelKey`)
VALUES (2, 32, 110, 0, NULL, '生产企业资质打印', NULL, NULL, NULL, NULL, 'reportForms');
INSERT ignore INTO `sys_pdf_template_relevance_statemen`(`id`, `templateId`, `customerId`, `adminId`, `moduleId`,
                                                         `localAction`, `remark1`, `remark2`, `remark3`, `printType`,
                                                         `modelKey`)
VALUES (3, 33, 110, 0, NULL, '配送产品资质打印', NULL, NULL, NULL, NULL, 'reportForms');
INSERT ignore INTO `sys_pdf_template_relevance_statemen`(`id`, `templateId`, `customerId`, `adminId`, `moduleId`,
                                                         `localAction`, `remark1`, `remark2`, `remark3`, `printType`,
                                                         `modelKey`)
VALUES (4, 33, 110, 0, NULL, '库存报表打印', NULL, NULL, NULL, NULL, 'reportForms');
INSERT ignore INTO `sys_pdf_template_relevance_statemen`(`id`, `templateId`, `customerId`, `adminId`, `moduleId`,
                                                         `localAction`, `remark1`, `remark2`, `remark3`, `printType`,
                                                         `modelKey`)
VALUES (5, 33, 110, 0, NULL, '内部码报表打印', NULL, NULL, NULL, NULL, 'reportForms');


INSERT ignore INTO `sys_scheduled`(`id`, `cronName`, `cron`, `customerId`, `remark`)
VALUES (140, 'dlThrSysHeartTask', '0 0/1 * * * ?', NULL, '第三方接口同步心跳');


CALL Pro_Temp_ColumnWork('io_stat_day', 'deptCode', 'varchar(255)', 1);
CALL Pro_Temp_ColumnWork('io_stat_month', 'deptCode', 'varchar(255)', 1);
CALL Pro_Temp_ColumnWork('io_stat_quarter', 'deptCode', 'varchar(255)', 1);
CALL Pro_Temp_ColumnWork('io_stat_year', 'deptCode', 'varchar(255)', 1);
CALL Pro_Temp_ColumnWork('io_order_detail_code', 'updateTime', 'datetime', 1);


CALL Pro_Temp_ColumnWork('basic_products', 'pinyinInitial', 'varchar(255)', 1);


CALL Pro_Temp_ColumnWork('thr_order_upload_bustypes', 'orderStatus', 'tinyint', 1);
CALL Pro_Temp_ColumnWork('thr_order_upload_bustypes', 'orderStartTime', 'datetime', 1);
CALL Pro_Temp_ColumnWork('thr_order_upload_bustypes', 'orderSource', 'varchar(1024)', 1);
CALL Pro_Temp_ColumnWork('inv_place_order_detail', 'topInvCode', 'varchar(255)', 1);
CALL Pro_Temp_ColumnWork('inv_place_order_detail', 'topInvSpaceCode', 'varchar(255)', 1);


call Modify_index('basic_products', 'uuid', 'idx_uuid', 'BTREE');
call Modify_index('basic_products', 'nameCode', 'idex_nameCode', 'BTREE');



CALL Pro_Temp_ColumnWork('basic_products', 'sfwblztlcp', 'varchar(255)', 1);
CALL Pro_Temp_ColumnWork('basic_products', 'cgzmraqxgxx', 'varchar(255)', 1);
CALL Pro_Temp_ColumnWork('basic_products', 'sfbjwycxsy', 'varchar(255)', 1);
CALL Pro_Temp_ColumnWork('basic_udirel', 'zdcfsycs', 'varchar(255)', 3);
CALL Pro_Temp_ColumnWork('basic_products', 'zdcfsycs', 'varchar(255)', 1);
CALL Pro_Temp_ColumnWork('basic_products', 'sfwwjbz', 'varchar(255)', 1);
CALL Pro_Temp_ColumnWork('basic_products', 'syqsfxyjxmj', 'varchar(255)', 1);
CALL Pro_Temp_ColumnWork('basic_products', 'mjfs', 'varchar(255)', 1);
CALL Pro_Temp_ColumnWork('basic_products', 'categoryName', 'varchar(255)', 1);



CALL Pro_Temp_ColumnWork('thr_system_detail', 'dlLastTime', 'int', 1);


INSERT ignore INTO `sys_param_config`(id, `parentId`, `paramName`, `paramKey`, `paramValue`, `paramStatus`,
                                      `paramType`,
                                      `paramExplain`, `updateTime`)
VALUES (20059, 0, '是否允许编辑第三方产品信息', 'enable_edit_third', '1', 0, 0, '0：否；1：是', NULL);

CREATE TABLE if not exists `basic_sk_project_detail`
(
    `id`    bigint(0) NOT NULL,
    `relId` bigint(0) NULL DEFAULT NULL COMMENT '耗材产品id',
    `pId`   bigint(0) NULL DEFAULT NULL COMMENT '定数包模板id',
    `count` int(0)    NULL DEFAULT NULL COMMENT '数量',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB
  CHARACTER SET = utf8mb4
  COLLATE = utf8mb4_0900_ai_ci COMMENT = '定数包产品关联表'
  ROW_FORMAT = Dynamic;


CALL Pro_Temp_ColumnWork('thr_products', 'type', 'int', 1);


CREATE TABLE if not exists `io_destiny_process`
(
    `id`         bigint(0)                                                     NOT NULL,
    `destinyId`  varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '定数包模板id',
    `destinyNo`  varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '唯一编码',
    `billNo`     varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '单据号',
    `billDate`   datetime(0)                                                   NULL DEFAULT NULL COMMENT '单据时间',
    `invCode`    varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '单前仓库',
    `remark`     varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '备注',
    `createTime` datetime(0)                                                   NULL DEFAULT NULL COMMENT '创建时间',
    `updateTime` datetime(0)                                                   NULL DEFAULT NULL COMMENT '更新时间',
    `createUser` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '创建人',
    `updateUser` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '更新人',
    `status`     int(0)                                                        NULL DEFAULT NULL COMMENT '状态 0 ：草稿 1：待校验 2：已校验',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB
  CHARACTER SET = utf8mb4
  COLLATE = utf8mb4_0900_ai_ci COMMENT = '定数包表'
  ROW_FORMAT = Dynamic;

CREATE TABLE if not exists `io_destiny_process_code`
(
    `id`          bigint(0)                                                     NOT NULL,
    `code`        varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
    `orderIdFk`   varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '订单号外键',
    `bindRlFk`    varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '耗材字典ID外键',
    `uuidFk`      varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT 'DI信息UUID外键',
    `nameCode`    varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT 'DI',
    `batchNo`     varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '批次号',
    `productDate` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '生产日期',
    `expireDate`  varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '失效日期',
    `price`       decimal(10, 2)                                                NULL DEFAULT NULL COMMENT '价格',
    `supId`       varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '供应商ID外键',
    `count`       int(0)                                                        NULL DEFAULT NULL COMMENT '单据数量',
    `updateTime`  datetime(0)                                                   NULL DEFAULT NULL,
    `serialNo`    varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
    `reCount`     int(0)                                                        NULL DEFAULT NULL,
    PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB
  CHARACTER SET = utf8mb4
  COLLATE = utf8mb4_0900_ai_ci COMMENT = '定速包加工明细表'
  ROW_FORMAT = Dynamic;

CREATE TABLE if not exists `io_destiny_process_detail`
(
    `id`         bigint(0)                                                     NOT NULL,
    `relId`      bigint(0)                                                     NULL DEFAULT NULL COMMENT '耗材产品id',
    `count`      int(0)                                                        NULL DEFAULT NULL COMMENT '数量',
    `reCount`    int(0)                                                        NULL DEFAULT 0 COMMENT '实际数量',
    `updateTime` datetime(0)                                                   NULL DEFAULT NULL,
    `orderIdFk`  varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '订单号外键',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB
  CHARACTER SET = utf8mb4
  COLLATE = utf8mb4_0900_ai_ci COMMENT = '定数包产品关联表'
  ROW_FORMAT = Dynamic;


CALL Pro_Temp_ColumnWork('io_order', 'outSickInfo', 'varchar(255)', 1);
CALL Pro_Temp_ColumnWork('inv_inner_order_detail', 'nameCode', 'varchar(255)', 1);
CALL Pro_Temp_ColumnWork('inv_inner_order_detail', 'nameCode',
                         'varchar(255) ', 1);

CALL Pro_Temp_ColumnWork('io_order', 'fromSpmsOrders', 'varchar(255)', 1);


CALL Pro_Temp_ColumnWork('basic_bussiness_type', 'checkReview', 'tinyint', 1);
CALL Pro_Temp_ColumnWork('basic_bussiness_type', 'secCheckReview', 'tinyint', 1);
CALL Pro_Temp_ColumnWork('basic_bussiness_type', 'thrCheckReview', 'tinyint', 1);
CALL Pro_Temp_ColumnWork('basic_bussiness_type', 'editType', 'tinyint', 1);


CALL Pro_Temp_ColumnWork('auth_user', 'lastUpdatePwdTime', 'datetime', 1);


CALL Pro_Temp_ColumnWork('io_code', 'price', 'decimal(10, 3)', 1);
CALL Pro_Temp_ColumnWork('io_code_temp', 'price', 'decimal(10, 3)', 1);
CALL Pro_Temp_ColumnWork('inv_prein_product', 'price', 'decimal(10, 3)', 1);
CALL Pro_Temp_ColumnWork('inv_product', 'price', 'decimal(10, 3)', 1);
CALL Pro_Temp_ColumnWork('inv_pre_product', 'price', 'decimal(10, 3)', 1);
CALL Pro_Temp_ColumnWork('inv_product_detail', 'price', 'decimal(10, 3)', 1);
CALL Pro_Temp_ColumnWork('inv_prein_product_detail', 'price', 'decimal(10, 3)', 1);
CALL Pro_Temp_ColumnWork('inv_pre_product_detail', 'price', 'decimal(10, 3)', 1);


CALL Pro_Temp_ColumnWork('io_code', 'inBatchNo', 'varchar(255)', 1);
CALL Pro_Temp_ColumnWork('io_code_temp', 'inBatchNo', 'varchar(255)', 1);
CALL Pro_Temp_ColumnWork('inv_product_detail', 'inBatchNo', 'varchar(255)', 1);
CALL Pro_Temp_ColumnWork('inv_prein_product_detail', 'inBatchNo', 'varchar(255)', 1);
CALL Pro_Temp_ColumnWork('inv_pre_product_detail', 'inBatchNo', 'varchar(255)', 1);
INSERT ignore INTO `sys_param_config`(`id`, `parentId`, `paramName`, `paramKey`, `paramValue`, `paramStatus`,
                                      `paramType`, `paramExplain`, `updateTime`)
VALUES (20078, 0, '是否启用价格先进先出策略', 'price_fifo', '1', 1, 0, '0：否；1：是', '2023-10-10 10:10:08');


CREATE TABLE if not exists `inv_product_ration`
(
    `id`             int                                                           NOT NULL AUTO_INCREMENT,
    `relId`          bigint                                                        NULL DEFAULT NULL COMMENT '产品ID',
    `supId`          bigint                                                        NULL DEFAULT NULL COMMENT '供应商ID',
    `rationCount`    int                                                           NULL DEFAULT NULL COMMENT '定量数',
    `invCount`       int                                                           NULL DEFAULT NULL COMMENT '库存数',
    `busType`        varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '业务单据类型',
    `scanType`       varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '扫码单据类型',
    `curInvCode`     varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '当前仓库',
    `lyInvCode`      varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '业务-领用仓库',
    `sgInvCode`      varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '业务-申购采购仓库',
    `jhInvCode`      varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '业务-计划采购仓库',
    `cgInvCode`      varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '业务-订单采购仓库',
    `fromInvCode`    varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '出入库-往来仓库',
    `auditStatus`    tinyint                                                       NULL DEFAULT NULL COMMENT '出入库-审核状态',
    `busAuditStatus` tinyint                                                       NULL DEFAULT NULL COMMENT '业务-审核状态',
    `scanOrder`      varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '生成扫码单据',
    `busOrder`       varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '生成业务单据',
    `updateTime`     datetime(0)                                                   NULL DEFAULT NULL COMMENT '更新时间',
    `updateUser`     varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '更新人',
    `createTime`     datetime(0)                                                   NULL DEFAULT NULL COMMENT '创建时间',
    `createUser`     varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '创建人',
    `remark`         varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
    PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB
  AUTO_INCREMENT = 8
  CHARACTER SET = utf8mb4
  COLLATE = utf8mb4_0900_ai_ci
  ROW_FORMAT = Dynamic;

INSERT ignore INTO `sys_scheduled`(`id`, `cronName`, `cron`, `customerId`, `remark`)
VALUES (150, 'syncInvRation', '0 */60 * * * ?', NULL, '定量设置单据');



INSERT ignore INTO `auth_menu`(`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query_param`,
                               `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`,
                               `create_time`, `update_by`, `update_time`, `remark`)
VALUES (2011, '库存定量设置', 1633, 10, 'sys/invRation/set', 'system/ration/InvRationSet', NULL, 1, 0, 'C', '0', '0', NULL,
        NULL, '超级用户', '2023-10-13 11:03:11', NULL, NULL, NULL);
INSERT ignore INTO `auth_menu`(`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query_param`,
                               `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`,
                               `create_time`, `update_by`, `update_time`, `remark`)
VALUES (2012, '定量新增', 2011, 1, NULL, NULL, NULL, 1, 0, 'F', '0', '0', 'system:ration:add', NULL, '超级用户',
        '2023-10-18 09:34:39', NULL, NULL, NULL);
INSERT ignore INTO `auth_menu`(`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query_param`,
                               `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`,
                               `create_time`, `update_by`, `update_time`, `remark`)
VALUES (2013, '定量删除', 2011, 2, NULL, NULL, NULL, 1, 0, 'F', '0', '0', 'system:ration:del', NULL, '超级用户',
        '2023-10-18 09:35:07', NULL, NULL, NULL);
INSERT ignore INTO `auth_menu`(`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query_param`,
                               `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`,
                               `create_time`, `update_by`, `update_time`, `remark`)
VALUES (2014, '定量修改', 2011, 3, NULL, NULL, NULL, 1, 0, 'F', '0', '0', 'system:ration:edit', NULL, '超级用户',
        '2023-10-18 09:35:26', NULL, NULL, NULL);
INSERT ignore INTO `auth_menu`(`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query_param`,
                               `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`,
                               `create_time`, `update_by`, `update_time`, `remark`)
VALUES (2015, '单据生成', 2011, 4, NULL, NULL, NULL, 1, 0, 'F', '0', '0', 'system:ration:gen', NULL, '超级用户',
        '2023-10-18 09:35:50', NULL, NULL, NULL);


CALL Pro_Temp_ColumnWork('io_order_detail_result', 'inoutPrintStatus', 'tinyint', 1);
CALL Pro_Temp_ColumnWork('inv_count_setting', 'invStorageCode', 'varchar(255)', 1);
CALL Pro_Temp_ColumnWork('inv_count_setting', 'invWarehouseCode', 'varchar(255)', 1);
CALL Pro_Temp_ColumnWork('inv_count_setting', 'inFromCorp', 'varchar(255)', 1);
CALL Pro_Temp_ColumnWork('inv_count_setting', 'outFromCorp', 'varchar(255)', 1);


CALL Pro_Temp_ColumnWork('inv_count_codes', 'nameCode', 'varchar(255)', 1);
CALL Pro_Temp_ColumnWork('inv_count_codes', 'produceDate', 'varchar(255)', 1);
CALL Pro_Temp_ColumnWork('inv_count_codes', 'expireDate', 'varchar(255)', 1);
CALL Pro_Temp_ColumnWork('inv_count_codes', 'serialNo', 'varchar(255)', 1);
CALL Pro_Temp_ColumnWork('inv_count_order', 'codeCount', 'varchar(255)', 1);
CALL Pro_Temp_ColumnWork('io_stat_order', 'deptCode', 'varchar(255)', 1);
CALL Pro_Temp_ColumnWork('io_stat_order', 'invCode', 'varchar(255)', 1);
CALL Pro_Temp_ColumnWork('io_stat_day', 'invCode', 'varchar(255)', 1);
CALL Pro_Temp_ColumnWork('io_stat_month', 'invCode', 'varchar(255)', 1);
CALL Pro_Temp_ColumnWork('io_stat_quarter', 'invCode', 'varchar(255)', 1);
CALL Pro_Temp_ColumnWork('io_stat_year', 'invCode', 'varchar(255)', 1);


CALL Pro_Temp_ColumnWork('auth_warehouse', 'lyInvType', 'tinyint', 1);

CALL Pro_Temp_ColumnWork('pur_receive_detail', 'price', 'decimal(10, 2)', 1);
CALL Pro_Temp_ColumnWork('basic_corp', 'adSickNum', 'varchar(255)', 1);

CALL Pro_Temp_ColumnWork('basic_bustype_pre', 'splitOrder', 'tinyint', 1);

