-- 第三方点检异常工单（待处理/已处理）
IF NOT EXISTS (SELECT 1 FROM sys.tables WHERE name = 'T_thirdparty_inspection_work_orders')
BEGIN
    CREATE TABLE dbo.T_thirdparty_inspection_work_orders (
        F_ID INT IDENTITY(1,1) PRIMARY KEY,
        F_task_id INT NOT NULL,
        F_car_id INT NULL,
        F_status INT NOT NULL DEFAULT 0,
        F_fail_summary NVARCHAR(500) NULL,
        F_inspector NVARCHAR(50) NULL,
        F_area NVARCHAR(100) NULL,
        F_assignees NVARCHAR(500) NULL,
        F_handler NVARCHAR(50) NULL,
        F_wx_id INT NULL,
        F_create_time DATETIME NOT NULL DEFAULT GETDATE(),
        F_handle_time DATETIME NULL,
        CONSTRAINT UQ_thirdparty_inspection_wo_task UNIQUE (F_task_id)
    );
    CREATE INDEX IX_inspection_wo_status ON dbo.T_thirdparty_inspection_work_orders(F_status);
    CREATE INDEX IX_inspection_wo_area ON dbo.T_thirdparty_inspection_work_orders(F_area);
END
GO
