USE [wms-skt-demo]
GO
/****** Object:  Table [dbo].[Authority]    Script Date: 6/21/2024 4:29:42 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Authority](
	[id] [varchar](100) NOT NULL,
	[name] [nvarchar](400) NULL,
	[division] [tinyint] NOT NULL,
	[name_id] [varchar](100) NULL,
	[period_from] [datetime] NULL,
	[period_to] [datetime] NULL,
	[create_dt] [datetime2](3) NULL,
	[create_user_id] [varchar](100) NULL,
	[update_dt] [datetime2](3) NULL,
	[update_user_id] [varchar](100) NULL,
 CONSTRAINT [PK_Authority_] PRIMARY KEY CLUSTERED 
(
	[id] ASC,
	[division] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Bom]    Script Date: 6/21/2024 4:29:42 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Bom](
	[id] [bigint] IDENTITY(1,1) NOT NULL,
	[product_no] [varchar](100) NOT NULL,
	[ref_parts_no] [varchar](100) NULL,
	[parts_no] [varchar](100) NOT NULL,
	[sec] [tinyint] NOT NULL,
	[sub] [tinyint] NULL,
	[parts_name] [varchar](100) NULL,
	[qty_ratio] [varchar](20) NULL,
	[prod_level] [varchar](10) NULL,
	[section] [varchar](10) NULL,
	[delivery_date_cnt] [int] NULL,
	[unit_qty] [varchar](20) NULL,
	[supplier] [varchar](100) NULL,
	[supplier_no] [varchar](10) NULL,
	[revision] [smallint] NULL,
	[period_from] [datetime2](3) NULL,
	[period_to] [datetime2](3) NULL,
	[create_dt] [datetime2](3) NOT NULL,
	[create_user_id] [varchar](100) NULL,
	[update_dt] [datetime2](3) NULL,
	[update_user_id] [varchar](100) NULL,
	[status] [tinyint] NOT NULL,
	[outsource_prod] [tinyint] NOT NULL,
	[incharge] [varchar](10) NULL,
	[store_section] [varchar](10) NULL,
 CONSTRAINT [PK_Bom_1] PRIMARY KEY CLUSTERED 
(
	[id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Department]    Script Date: 6/21/2024 4:29:42 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Department](
	[id] [varchar](100) NOT NULL,
	[name] [nvarchar](400) NULL,
	[division] [tinyint] NOT NULL,
	[period_from] [datetime] NULL,
	[period_to] [datetime] NULL,
	[create_dt] [datetime2](3) NULL,
	[create_user_id] [varchar](100) NULL,
	[update_dt] [datetime2](3) NULL,
	[update_user_id] [varchar](100) NULL,
 CONSTRAINT [PK_Department] PRIMARY KEY CLUSTERED 
(
	[id] ASC,
	[division] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ExportInbound]    Script Date: 6/21/2024 4:29:42 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ExportInbound](
	[id] [bigint] IDENTITY(1,1) NOT NULL,
	[product_no0] [varchar](3) NULL,
	[product_no1] [varchar](7) NULL,
	[product_no2] [varchar](2) NULL,
	[actual_quantity_received] [numeric](24, 2) NULL,
	[stock_receipt_date] [varchar](8) NULL,
	[invoice_no] [varchar](30) NULL,
	[seq_no] [int] NOT NULL,
	[order_no] [varchar](8) NULL,
	[ref_sch_id] [bigint] NULL,
	[ref_id] [bigint] NULL,
	[ref_type] [varchar](100) NULL,
	[status_export] [tinyint] NOT NULL,
	[create_dt] [datetime] NOT NULL,
	[create_user_id] [varchar](20) NULL,
	[update_dt] [datetime] NULL,
	[update_user_id] [varchar](20) NULL,
	[export_dt] [datetime] NULL,
	[export_user_id] [varchar](20) NULL,
	[lot_no] [varchar](10) NULL,
 CONSTRAINT [PK_ExportInbound] PRIMARY KEY CLUSTERED 
(
	[id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ImportDeliveryPlan]    Script Date: 6/21/2024 4:29:42 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ImportDeliveryPlan](
	[supplier_no] [varchar](50) NULL,
	[item_no] [varchar](10) NULL,
	[part_no] [varchar](50) NULL,
	[part_name] [varchar](200) NULL,
	[qty] [numeric](18, 0) NULL,
	[receive] [varchar](20) NULL,
	[filename] [varchar](200) NOT NULL,
	[ref_id] [bigint] NULL,
	[create_dt] [datetime] NOT NULL,
	[create_user_id] [varchar](20) NULL,
	[update_dt] [datetime] NULL,
	[update_user_id] [varchar](20) NULL,
	[id] [int] IDENTITY(1,1) NOT NULL,
 CONSTRAINT [PK__ImportDe__3213E83F79D04E82] PRIMARY KEY CLUSTERED 
(
	[id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY],
 CONSTRAINT [UX_ImportDeliveryPlan] UNIQUE NONCLUSTERED 
(
	[filename] ASC,
	[item_no] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ImportPurchaseOrder]    Script Date: 6/21/2024 4:29:42 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ImportPurchaseOrder](
	[doc_date] [varchar](20) NULL,
	[supplier_no] [varchar](20) NULL,
	[purchase_name] [varchar](50) NULL,
	[po_no] [varchar](50) NULL,
	[item_no] [varchar](10) NULL,
	[part_no] [varchar](50) NULL,
	[part_name] [varchar](200) NULL,
	[qty] [numeric](18, 0) NULL,
	[unit_qty] [varchar](20) NULL,
	[unit_price] [varchar](20) NULL,
	[amount] [varchar](20) NULL,
	[remark] [varchar](200) NULL,
	[filename] [varchar](200) NOT NULL,
	[ref_id] [bigint] NULL,
	[create_dt] [datetime] NOT NULL,
	[create_user_id] [varchar](20) NULL,
	[update_dt] [datetime] NULL,
	[update_user_id] [varchar](20) NULL,
	[id] [bigint] IDENTITY(1,1) NOT NULL,
	[receive] [varchar](20) NULL,
 CONSTRAINT [PK__ImportPu__3213E83F07D393D1] PRIMARY KEY CLUSTERED 
(
	[id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY],
 CONSTRAINT [UX_ImportPurchaseOrder] UNIQUE NONCLUSTERED 
(
	[filename] ASC,
	[item_no] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ImportTransaction]    Script Date: 6/21/2024 4:29:42 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ImportTransaction](
	[id] [bigint] IDENTITY(1,1) NOT NULL,
	[filename] [varchar](200) NULL,
	[fullpath_filename] [varchar](200) NULL,
	[type] [varchar](50) NULL,
	[row_total] [numeric](18, 0) NULL,
	[row_proceed] [numeric](18, 0) NULL,
	[upload_dt] [datetime] NULL,
	[status] [varchar](20) NULL,
	[create_dt] [datetime] NOT NULL,
	[create_user_id] [varchar](50) NULL,
	[update_dt] [datetime] NULL,
	[update_user_id] [varchar](50) NULL,
 CONSTRAINT [PK_ScheduleImportTrans] PRIMARY KEY CLUSTERED 
(
	[id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ImportTransactionReport]    Script Date: 6/21/2024 4:29:42 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ImportTransactionReport](
	[id] [bigint] IDENTITY(1,1) NOT NULL,
	[topic] [varchar](200) NULL,
	[detail] [varchar](1000) NULL,
	[raw_data] [varchar](1000) NULL,
	[type] [varchar](50) NULL,
	[ref_id] [int] NOT NULL,
	[row_affected] [numeric](18, 0) NOT NULL,
	[create_dt] [datetime] NOT NULL,
	[create_user_id] [varchar](50) NULL,
	[update_dt] [datetime] NULL,
	[update_user_id] [varchar](50) NULL,
 CONSTRAINT [PK_ImportTransactionReport] PRIMARY KEY CLUSTERED 
(
	[id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Inbound]    Script Date: 6/21/2024 4:29:42 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Inbound](
	[id] [bigint] IDENTITY(1,1) NOT NULL,
	[item_id] [varchar](40) NULL,
	[item_name] [nvarchar](400) NULL,
	[supplier_id] [varchar](20) NULL,
	[supplier_name] [nvarchar](400) NULL,
	[package_id] [varchar](50) NULL,
	[package_qty] [decimal](24, 2) NULL,
	[lot_no] [varchar](20) NULL,
	[order_no] [varchar](50) NULL,
	[qty] [decimal](24, 2) NULL,
	[unit_qty] [varchar](50) NULL,
	[location_id] [varchar](20) NULL,
	[location_name] [nvarchar](400) NULL,
	[ref_sch_id] [bigint] NULL,
	[label_id] [bigint] NULL,
	[status] [tinyint] NULL,
	[slip_divide] [smallint] NULL,
	[create_dt] [datetime2](3) NULL,
	[create_user_id] [varchar](100) NULL,
	[update_dt] [datetime2](3) NULL,
	[update_user_id] [varchar](100) NULL,
	[inspection_flg] [tinyint] NOT NULL,
	[inspection_dt] [datetime] NULL,
	[inspection_user_id] [varchar](100) NULL,
	[remark] [nvarchar](200) NULL,
	[ng] [decimal](24, 2) NOT NULL,
	[ng_reason] [varchar](200) NULL,
	[ng_qc_user_id] [varchar](100) NULL,
	[kanban_serial] [varchar](20) NULL,
 CONSTRAINT [PK_Inbound] PRIMARY KEY CLUSTERED 
(
	[id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Item]    Script Date: 6/21/2024 4:29:42 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Item](
	[id] [varchar](40) NOT NULL,
	[name] [nvarchar](400) NULL,
	[unit_price] [decimal](18, 2) NULL,
	[division] [tinyint] NOT NULL,
	[order_point] [int] NULL,
	[safety_stock] [int] NULL,
	[trgt_ivnt_turnover] [decimal](18, 2) NULL,
	[period_from] [datetime2](3) NULL,
	[period_to] [datetime2](3) NULL,
	[create_dt] [datetime2](3) NULL,
	[create_user_id] [varchar](100) NULL,
	[update_dt] [datetime2](3) NULL,
	[update_user_id] [varchar](100) NULL,
	[location_fix_id] [varchar](20) NULL,
	[location_last_id] [varchar](20) NULL,
	[store_type] [varchar](20) NULL,
	[comment] [varchar](200) NULL,
	[img1] [varchar](200) NULL,
	[img2] [varchar](200) NULL,
	[pick_assy_once] [varchar](50) NULL,
	[control_unit] [varchar](50) NULL,
	[stock_in] [varchar](50) NULL,
	[stock_out] [varchar](50) NULL,
	[remaining_stock] [varchar](50) NULL,
	[store_stock_out] [varchar](50) NULL,
	[store_section] [varchar](50) NULL,
	[stock_out_min_qty] [decimal](18, 2) NULL,
	[uncontrol_flg] [tinyint] NOT NULL,
	[supplier_id] [varchar](50) NULL,
	[dwg_no] [varchar](50) NULL,
	[dwg_name] [varchar](100) NULL,
	[rank] [varchar](10) NULL,
 CONSTRAINT [PK_Item] PRIMARY KEY CLUSTERED 
(
	[id] ASC,
	[division] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Kanban]    Script Date: 6/21/2024 4:29:42 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Kanban](
	[id] [bigint] IDENTITY(1,1) NOT NULL,
	[kanban_code] [varchar](40) NOT NULL,
	[kanban_class] [varchar](10) NOT NULL,
	[remainder_class] [varchar](10) NOT NULL,
	[item_id] [varchar](100) NOT NULL,
	[kanban_serial] [varchar](20) NOT NULL,
	[status] [tinyint] NULL,
	[create_dt] [datetime2](3) NULL,
	[create_user_id] [varchar](100) NULL,
	[update_dt] [datetime2](3) NULL,
	[update_user_id] [varchar](100) NULL,
 CONSTRAINT [PK_Kanban] PRIMARY KEY CLUSTERED 
(
	[id] ASC,
	[kanban_serial] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[KanbanCode]    Script Date: 6/21/2024 4:29:42 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[KanbanCode](
	[id] [int] IDENTITY(1,1) NOT NULL,
	[kanban_code] [varchar](10) NOT NULL,
	[kanban_name] [varchar](255) NOT NULL,
 CONSTRAINT [PK__KanbanCo__336C7E60C3ED028B] PRIMARY KEY CLUSTERED 
(
	[id] ASC,
	[kanban_code] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[KanbanTransfer]    Script Date: 6/21/2024 4:29:42 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[KanbanTransfer](
	[id] [bigint] IDENTITY(1,1) NOT NULL,
	[temp_kanban] [varchar](100) NULL,
	[temp_parts_no] [nvarchar](50) NULL,
	[temp_serial_no] [varchar](10) NULL,
	[temp_qty] [decimal](24, 2) NULL,
	[temp_status] [varchar](20) NULL,
	[normal_kanban] [varchar](100) NULL,
	[normal_parts_no] [nvarchar](50) NULL,
	[normal_serial_no] [varchar](10) NULL,
	[normal_qty] [decimal](24, 2) NULL,
	[normal_status] [varchar](20) NULL,
	[create_dt] [datetime] NULL,
	[create_user_id] [varchar](100) NULL,
	[update_dt] [datetime] NULL,
	[update_user_id] [varchar](100) NULL,
 CONSTRAINT [PK_KanbanTransfer] PRIMARY KEY CLUSTERED 
(
	[id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Location]    Script Date: 6/21/2024 4:29:42 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Location](
	[id] [varchar](20) NOT NULL,
	[name] [nvarchar](100) NOT NULL,
	[division] [tinyint] NOT NULL,
	[period_from] [datetime] NULL,
	[period_to] [datetime] NULL,
	[create_dt] [datetime2](3) NULL,
	[create_user_id] [varchar](100) NULL,
	[update_dt] [datetime2](3) NULL,
	[update_user_id] [varchar](100) NULL,
 CONSTRAINT [PK_Location] PRIMARY KEY CLUSTERED 
(
	[id] ASC,
	[division] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Login]    Script Date: 6/21/2024 4:29:42 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Login](
	[user_id] [varchar](100) NOT NULL,
	[create_dt] [datetime2](3) NOT NULL,
	[user_name] [varchar](100) NULL,
	[ip] [varchar](50) NULL,
	[update_dt] [datetime2](3) NOT NULL,
 CONSTRAINT [PK_Login] PRIMARY KEY CLUSTERED 
(
	[user_id] ASC,
	[create_dt] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Menu]    Script Date: 6/21/2024 4:29:42 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Menu](
	[id] [varchar](100) NOT NULL,
	[name] [nvarchar](400) NULL,
	[lang_id] [varchar](2) NOT NULL,
	[script] [varchar](100) NULL,
	[create_dt] [datetime2](3) NULL,
	[create_user_id] [varchar](100) NULL,
	[update_dt] [datetime2](3) NULL,
	[update_user_id] [varchar](100) NULL,
 CONSTRAINT [PK_Menu_] PRIMARY KEY CLUSTERED 
(
	[id] ASC,
	[lang_id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Outbound]    Script Date: 6/21/2024 4:29:42 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Outbound](
	[id] [bigint] IDENTITY(1,1) NOT NULL,
	[item_id] [varchar](40) NULL,
	[item_name] [nvarchar](400) NULL,
	[customer_id] [varchar](20) NULL,
	[customer_name] [nvarchar](400) NULL,
	[package_id] [varchar](50) NULL,
	[package_qty] [decimal](24, 2) NULL,
	[lot_no] [varchar](20) NULL,
	[order_no] [varchar](50) NULL,
	[qty] [decimal](24, 2) NULL,
	[unit_qty] [varchar](50) NULL,
	[location_id] [varchar](20) NULL,
	[location_name] [nvarchar](400) NULL,
	[ref_sch_id] [bigint] NULL,
	[label_id] [bigint] NULL,
	[status] [tinyint] NULL,
	[slip_divide] [smallint] NULL,
	[create_dt] [datetime2](3) NULL,
	[create_user_id] [varchar](100) NULL,
	[update_dt] [datetime2](3) NULL,
	[update_user_id] [varchar](100) NULL,
	[kanban_serial] [varchar](20) NULL,
 CONSTRAINT [PK_Outbound] PRIMARY KEY CLUSTERED 
(
	[id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[PackingStandard]    Script Date: 6/21/2024 4:29:42 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[PackingStandard](
	[id] [int] IDENTITY(1,1) NOT NULL,
	[item_id] [varchar](40) NOT NULL,
	[package_id] [varchar](20) NOT NULL,
	[qty] [decimal](18, 2) NOT NULL,
	[unit_qty] [varchar](50) NULL,
	[division] [tinyint] NOT NULL,
	[period_from] [datetime2](3) NULL,
	[period_to] [datetime2](3) NULL,
	[create_dt] [datetime2](3) NULL,
	[create_user_id] [varchar](100) NULL,
	[update_dt] [datetime2](3) NULL,
	[update_user_id] [varchar](100) NULL,
	[remark] [varchar](100) NULL,
 CONSTRAINT [PK_PackageTypeRFID] PRIMARY KEY CLUSTERED 
(
	[id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY],
 CONSTRAINT [UX_PackingStandard] UNIQUE NONCLUSTERED 
(
	[item_id] ASC,
	[package_id] ASC,
	[unit_qty] ASC,
	[division] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ProductionInbound]    Script Date: 6/21/2024 4:29:42 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ProductionInbound](
	[id] [bigint] IDENTITY(1,1) NOT NULL,
	[prod_schd_id] [bigint] NULL,
	[Line] [nvarchar](50) NULL,
	[FGparts] [nvarchar](50) NULL,
	[parts_no] [nvarchar](50) NULL,
	[serial_no] [varchar](10) NULL,
	[qty] [int] NULL,
	[status] [varchar](20) NULL,
	[create_dt] [datetime] NULL,
	[create_user_id] [varchar](100) NULL,
	[update_dt] [datetime] NULL,
	[update_user_id] [varchar](100) NULL,
	[kanban_code] [varchar](10) NULL,
	[kanban_class] [varchar](10) NULL,
	[remainder_class] [varchar](10) NULL,
	[FGparts_Kanban] [varchar](100) NULL,
 CONSTRAINT [PK_ProductionInbound] PRIMARY KEY CLUSTERED 
(
	[id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ProductionOutbound]    Script Date: 6/21/2024 4:29:42 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ProductionOutbound](
	[id] [bigint] IDENTITY(1,1) NOT NULL,
	[prod_schd_id] [bigint] NULL,
	[Line] [nvarchar](50) NULL,
	[FGparts] [nvarchar](50) NULL,
	[parts_no] [nvarchar](50) NULL,
	[serial_no] [varchar](10) NULL,
	[qty] [int] NULL,
	[status] [varchar](20) NULL,
	[create_dt] [datetime] NULL,
	[create_user_id] [varchar](100) NULL,
	[update_dt] [datetime] NULL,
	[update_user_id] [varchar](100) NULL,
	[kanban_code] [varchar](10) NULL,
	[kanban_class] [varchar](10) NULL,
	[remainder_class] [varchar](10) NULL,
	[FGparts_Kanban] [varchar](100) NULL,
 CONSTRAINT [PK_ProductionOutbound] PRIMARY KEY CLUSTERED 
(
	[id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ProductionSchedule]    Script Date: 6/21/2024 4:29:42 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ProductionSchedule](
	[id] [bigint] IDENTITY(1,1) NOT NULL,
	[po_no] [varchar](50) NULL,
	[invoice_no] [varchar](50) NULL,
	[order_no] [varchar](50) NULL,
	[parts_no] [varchar](50) NULL,
	[parts_name] [nvarchar](400) NULL,
	[qty] [decimal](24, 2) NULL,
	[unit_qty] [varchar](50) NULL,
	[order_dt] [datetime] NULL,
	[section] [varchar](50) NULL,
	[incharge] [varchar](50) NULL,
	[action_type] [varchar](50) NULL,
	[action_plan_date] [date] NULL,
	[action_act_dt] [datetime] NULL,
	[action_act_qty] [decimal](24, 2) NOT NULL,
	[action_user_id] [varchar](50) NULL,
	[inspection_flg] [tinyint] NOT NULL,
	[uncontrol_flg] [tinyint] NULL,
	[status] [varchar](20) NULL,
	[create_dt] [datetime] NULL,
	[create_user_id] [varchar](100) NULL,
	[update_dt] [datetime] NULL,
	[update_user_id] [varchar](100) NULL,
	[ref_id] [bigint] NULL,
	[ref_type] [varchar](50) NULL,
	[bom_ref_id] [bigint] NULL,
	[remark] [varchar](200) NULL,
	[prod_level] [varchar](10) NULL,
	[ref_parts_no] [varchar](100) NULL,
	[qty_ratio] [varchar](20) NULL,
	[action_det] [varchar](100) NULL,
	[seq] [tinyint] NULL,
	[proc_seq] [tinyint] NULL,
	[confirm_flg] [tinyint] NOT NULL,
	[confirm_dt] [datetime] NULL,
	[confirm_user_id] [varchar](100) NULL,
	[control_unit] [varchar](50) NULL,
	[supplier_id] [varchar](20) NULL,
 CONSTRAINT [PK_ProductionSchedule] PRIMARY KEY CLUSTERED 
(
	[id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY],
 CONSTRAINT [UX_ProductionSchedule] UNIQUE NONCLUSTERED 
(
	[po_no] ASC,
	[invoice_no] ASC,
	[order_no] DESC,
	[parts_no] ASC,
	[ref_id] DESC,
	[ref_type] ASC,
	[bom_ref_id] ASC,
	[action_det] ASC,
	[qty] ASC,
	[unit_qty] ASC,
	[action_plan_date] DESC,
	[ref_parts_no] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Record_KB]    Script Date: 6/21/2024 4:29:42 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Record_KB](
	[id] [bigint] IDENTITY(1,1) NOT NULL,
	[logDate] [nvarchar](20) NULL,
	[logTime] [nvarchar](20) NULL,
	[HTID] [nvarchar](50) NULL,
	[userName] [nvarchar](50) NULL,
	[PDS] [nvarchar](100) NULL,
	[CustomerKB] [nvarchar](50) NULL,
	[CustomerQty] [nvarchar](50) NULL,
	[SKTKB] [nvarchar](50) NULL,
	[SKTKBSerial] [nvarchar](20) NULL,
	[SKTQTY] [nvarchar](50) NULL,
	[ResultKB] [nvarchar](20) NULL,
	[ResultQT] [nvarchar](20) NULL,
	[Approve] [nvarchar](50) NULL,
	[systemDateTime] [datetime] NULL,
 CONSTRAINT [PK_Record_KB] PRIMARY KEY CLUSTERED 
(
	[id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Record_PDS]    Script Date: 6/21/2024 4:29:42 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Record_PDS](
	[id] [bigint] IDENTITY(1,1) NOT NULL,
	[logDate] [nvarchar](20) NULL,
	[logTime] [nvarchar](20) NULL,
	[HTID] [nvarchar](50) NULL,
	[userName] [nvarchar](50) NULL,
	[PDS] [nvarchar](100) NULL,
	[systemDateTime] [datetime] NULL,
 CONSTRAINT [PK_Record_PDS] PRIMARY KEY CLUSTERED 
(
	[id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[SerialNo]    Script Date: 6/21/2024 4:29:42 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[SerialNo](
	[id] [bigint] IDENTITY(1,1) NOT NULL,
	[prod_schd_id] [bigint] NULL,
	[parts_no] [nvarchar](50) NULL,
	[serial_no] [varchar](10) NULL,
	[qty] [decimal](24, 2) NULL,
	[status] [varchar](20) NULL,
	[create_dt] [datetime] NULL,
	[create_user_id] [varchar](100) NULL,
	[update_dt] [datetime] NULL,
	[update_user_id] [varchar](100) NULL,
	[kanban_code] [varchar](10) NULL,
	[kanban_class] [varchar](10) NULL,
	[remainder_class] [varchar](10) NULL,
 CONSTRAINT [PK_SerialNo] PRIMARY KEY CLUSTERED 
(
	[id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Stock]    Script Date: 6/21/2024 4:29:42 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Stock](
	[item_id] [varchar](40) NOT NULL,
	[location_id] [varchar](20) NOT NULL,
	[lot_no] [varchar](50) NOT NULL,
	[carry_over] [numeric](24, 2) NOT NULL,
	[qty] [numeric](24, 2) NOT NULL,
	[hold_qty] [numeric](24, 2) NOT NULL,
	[reserve_qty] [numeric](24, 2) NOT NULL,
	[create_dt] [datetime2](3) NULL,
	[create_user_id] [varchar](100) NULL,
	[update_dt] [datetime2](3) NULL,
	[update_user_id] [varchar](100) NULL,
	[kanban_serial] [varchar](20) NOT NULL,
 CONSTRAINT [PK_Stock] PRIMARY KEY CLUSTERED 
(
	[item_id] ASC,
	[location_id] ASC,
	[lot_no] ASC,
	[kanban_serial] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Stocktaking]    Script Date: 6/21/2024 4:29:42 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Stocktaking](
	[id] [bigint] IDENTITY(1,1) NOT NULL,
	[item_id] [varchar](40) NULL,
	[location_id] [varchar](20) NULL,
	[lot_no] [varchar](50) NULL,
	[serial_no] [varchar](10) NULL,
	[taking_month] [varchar](10) NULL,
	[st_qty] [numeric](24, 2) NOT NULL,
	[status] [varchar](20) NOT NULL,
	[qty] [numeric](24, 2) NOT NULL,
	[control_unit] [varchar](50) NULL,
	[create_dt] [datetime2](3) NULL,
	[create_user_id] [varchar](100) NULL,
	[update_dt] [datetime2](3) NULL,
	[update_user_id] [varchar](100) NULL,
	[confirm_dt] [datetime2](3) NULL,
	[confirm_user_id] [varchar](100) NULL,
	[remark] [varchar](1000) NULL,
	[label_id] [bigint] NULL,
	[division] [int] NOT NULL,
 CONSTRAINT [PK_Stocktaking] PRIMARY KEY CLUSTERED 
(
	[id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY],
 CONSTRAINT [IX_Stocktaking] UNIQUE NONCLUSTERED 
(
	[item_id] ASC,
	[location_id] ASC,
	[lot_no] DESC,
	[serial_no] DESC,
	[taking_month] DESC,
	[division] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[StockTracking]    Script Date: 6/21/2024 4:29:42 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[StockTracking](
	[id] [bigint] IDENTITY(1,1) NOT NULL,
	[item_id] [varchar](40) NOT NULL,
	[location_id] [varchar](20) NOT NULL,
	[lot_no] [varchar](20) NOT NULL,
	[inbound_qty] [numeric](24, 2) NOT NULL,
	[outbound_qty] [numeric](24, 2) NOT NULL,
	[increase] [numeric](24, 2) NOT NULL,
	[section] [varchar](50) NULL,
	[refer_id] [bigint] NULL,
	[create_dt] [datetime2](3) NULL,
	[create_user_id] [varchar](100) NULL,
	[update_dt] [datetime2](3) NULL,
	[update_user_id] [varchar](100) NULL,
	[slip_divide] [tinyint] NULL,
	[remark] [varchar](1000) NULL,
 CONSTRAINT [PK_StockTracking] PRIMARY KEY CLUSTERED 
(
	[id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[StoreOutbound]    Script Date: 6/21/2024 4:29:42 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[StoreOutbound](
	[id] [bigint] IDENTITY(1,1) NOT NULL,
	[store_kanban] [varchar](100) NULL,
	[store_parts_no] [nvarchar](50) NULL,
	[store_serial_no] [varchar](10) NULL,
	[store_qty] [decimal](24, 2) NULL,
	[store_status] [varchar](20) NULL,
	[pickup_kanban] [varchar](100) NULL,
	[pickup_parts_no] [nvarchar](50) NULL,
	[pickup_serial_no] [varchar](10) NULL,
	[pickup_qty] [decimal](24, 2) NULL,
	[pickup_status] [varchar](20) NULL,
	[create_dt] [datetime] NULL,
	[create_user_id] [varchar](100) NULL,
	[update_dt] [datetime] NULL,
	[update_user_id] [varchar](100) NULL,
 CONSTRAINT [PK_StoreOutbound] PRIMARY KEY CLUSTERED 
(
	[id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Supplier]    Script Date: 6/21/2024 4:29:42 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Supplier](
	[id] [varchar](20) NOT NULL,
	[id_internal] [varchar](20) NOT NULL,
	[name] [nvarchar](400) NULL,
	[division] [tinyint] NOT NULL,
	[period_from] [datetime] NULL,
	[period_to] [datetime] NULL,
	[alias] [varchar](40) NULL,
	[zip] [varchar](10) NULL,
	[address1] [varchar](200) NULL,
	[address2] [varchar](200) NULL,
	[tel] [varchar](50) NULL,
	[fax] [varchar](50) NULL,
	[email] [varchar](50) NULL,
	[person] [varchar](50) NULL,
	[remark] [varchar](100) NULL,
	[status] [numeric](4, 0) NULL,
	[create_dt] [datetime2](3) NULL,
	[create_user_id] [varchar](100) NULL,
	[update_dt] [datetime2](3) NULL,
	[update_user_id] [varchar](100) NULL,
 CONSTRAINT [PK_Supplier] PRIMARY KEY CLUSTERED 
(
	[id] ASC,
	[id_internal] ASC,
	[division] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Timezone]    Script Date: 6/21/2024 4:29:42 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Timezone](
	[id] [smallint] NOT NULL,
	[name] [varchar](100) NULL,
	[utc_offset] [varchar](100) NULL,
	[dst] [tinyint] NOT NULL
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Timezone_]    Script Date: 6/21/2024 4:29:42 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Timezone_](
	[id] [int] NOT NULL,
	[country_code] [varchar](2) NULL,
	[country_name] [varchar](100) NULL,
	[time_zone] [varchar](100) NULL,
	[gmt_offset] [varchar](16) NULL,
	[gmt_hour_offset] [varchar](8) NULL
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[UserCredential]    Script Date: 6/21/2024 4:29:42 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[UserCredential](
	[id] [varchar](100) NOT NULL,
	[division] [tinyint] NOT NULL,
	[password] [varchar](200) NULL,
	[status] [tinyint] NOT NULL,
	[period_from] [datetime2](3) NULL,
	[period_to] [datetime2](3) NULL,
	[create_dt] [datetime2](3) NOT NULL,
	[create_user_id] [varchar](100) NULL,
	[update_dt] [datetime2](3) NOT NULL,
	[update_user_id] [varchar](100) NULL,
 CONSTRAINT [PK_UserCredential] PRIMARY KEY CLUSTERED 
(
	[id] ASC,
	[division] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Users]    Script Date: 6/21/2024 4:29:42 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Users](
	[id] [varchar](100) NOT NULL,
	[name] [nvarchar](400) NULL,
	[division] [tinyint] NOT NULL,
	[lang_id] [varchar](2) NULL,
	[auth_id] [varchar](100) NULL,
	[dept_id] [varchar](100) NULL,
	[dept_division] [tinyint] NOT NULL,
	[timezone] [int] NULL,
	[period_from] [datetime] NULL,
	[period_to] [datetime] NULL,
	[create_dt] [datetime2](3) NOT NULL,
	[create_user_id] [varchar](100) NULL,
	[update_dt] [datetime2](3) NOT NULL,
	[update_user_id] [varchar](100) NULL,
	[homepage] [varchar](100) NULL,
 CONSTRAINT [PK_Users] PRIMARY KEY CLUSTERED 
(
	[id] ASC,
	[division] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[Authority] ADD  DEFAULT (sysdatetime()) FOR [create_dt]
GO
ALTER TABLE [dbo].[Authority] ADD  DEFAULT (sysdatetime()) FOR [update_dt]
GO
ALTER TABLE [dbo].[Bom] ADD  DEFAULT (getdate()) FOR [create_dt]
GO
ALTER TABLE [dbo].[Bom] ADD  DEFAULT ((1)) FOR [status]
GO
ALTER TABLE [dbo].[Bom] ADD  DEFAULT ((0)) FOR [outsource_prod]
GO
ALTER TABLE [dbo].[Department] ADD  DEFAULT (sysdatetime()) FOR [create_dt]
GO
ALTER TABLE [dbo].[Department] ADD  DEFAULT (sysdatetime()) FOR [update_dt]
GO
ALTER TABLE [dbo].[ExportInbound] ADD  DEFAULT ((0)) FOR [seq_no]
GO
ALTER TABLE [dbo].[ExportInbound] ADD  DEFAULT ((0)) FOR [status_export]
GO
ALTER TABLE [dbo].[ExportInbound] ADD  DEFAULT (getdate()) FOR [create_dt]
GO
ALTER TABLE [dbo].[ImportDeliveryPlan] ADD  DEFAULT (getdate()) FOR [create_dt]
GO
ALTER TABLE [dbo].[ImportPurchaseOrder] ADD  DEFAULT (getdate()) FOR [create_dt]
GO
ALTER TABLE [dbo].[ImportTransaction] ADD  DEFAULT ((0)) FOR [row_total]
GO
ALTER TABLE [dbo].[ImportTransaction] ADD  DEFAULT ((0)) FOR [row_proceed]
GO
ALTER TABLE [dbo].[ImportTransaction] ADD  DEFAULT (getdate()) FOR [upload_dt]
GO
ALTER TABLE [dbo].[ImportTransaction] ADD  DEFAULT (getdate()) FOR [create_dt]
GO
ALTER TABLE [dbo].[ImportTransactionReport] ADD  DEFAULT ((0)) FOR [row_affected]
GO
ALTER TABLE [dbo].[ImportTransactionReport] ADD  DEFAULT (getdate()) FOR [create_dt]
GO
ALTER TABLE [dbo].[Inbound] ADD  CONSTRAINT [DF_Inbound_create_dt]  DEFAULT (sysdatetime()) FOR [create_dt]
GO
ALTER TABLE [dbo].[Inbound] ADD  CONSTRAINT [DF_Inbound_update_dt]  DEFAULT (sysdatetime()) FOR [update_dt]
GO
ALTER TABLE [dbo].[Inbound] ADD  CONSTRAINT [DF_Inbound_inspection_flg]  DEFAULT ((0)) FOR [inspection_flg]
GO
ALTER TABLE [dbo].[Inbound] ADD  CONSTRAINT [DF_Inbound_ng]  DEFAULT ((0)) FOR [ng]
GO
ALTER TABLE [dbo].[Item] ADD  CONSTRAINT [DF_Item_create_dt]  DEFAULT (sysdatetime()) FOR [create_dt]
GO
ALTER TABLE [dbo].[Item] ADD  CONSTRAINT [DF_Item_update_dt]  DEFAULT (sysdatetime()) FOR [update_dt]
GO
ALTER TABLE [dbo].[Item] ADD  CONSTRAINT [DF_Item_pick_assy_once]  DEFAULT ((1)) FOR [pick_assy_once]
GO
ALTER TABLE [dbo].[Item] ADD  CONSTRAINT [DF_Item_uncontrol_flg]  DEFAULT ((0)) FOR [uncontrol_flg]
GO
ALTER TABLE [dbo].[Kanban] ADD  CONSTRAINT [DF_Kanban_create_dt]  DEFAULT (sysdatetime()) FOR [create_dt]
GO
ALTER TABLE [dbo].[Location] ADD  DEFAULT (sysdatetime()) FOR [create_dt]
GO
ALTER TABLE [dbo].[Location] ADD  DEFAULT (sysdatetime()) FOR [update_dt]
GO
ALTER TABLE [dbo].[Login] ADD  DEFAULT (sysdatetime()) FOR [create_dt]
GO
ALTER TABLE [dbo].[Login] ADD  DEFAULT (sysdatetime()) FOR [update_dt]
GO
ALTER TABLE [dbo].[Menu] ADD  DEFAULT (sysdatetime()) FOR [create_dt]
GO
ALTER TABLE [dbo].[Menu] ADD  DEFAULT (sysdatetime()) FOR [update_dt]
GO
ALTER TABLE [dbo].[Outbound] ADD  CONSTRAINT [DF_Outbound_create]  DEFAULT (sysdatetime()) FOR [create_dt]
GO
ALTER TABLE [dbo].[Outbound] ADD  CONSTRAINT [DF_Outbound_update]  DEFAULT (sysdatetime()) FOR [update_dt]
GO
ALTER TABLE [dbo].[PackingStandard] ADD  DEFAULT ((1)) FOR [division]
GO
ALTER TABLE [dbo].[PackingStandard] ADD  DEFAULT (sysdatetime()) FOR [create_dt]
GO
ALTER TABLE [dbo].[PackingStandard] ADD  DEFAULT (sysdatetime()) FOR [update_dt]
GO
ALTER TABLE [dbo].[ProductionSchedule] ADD  CONSTRAINT [DF_ProductionSchedule_action_act_qty]  DEFAULT ((0)) FOR [action_act_qty]
GO
ALTER TABLE [dbo].[ProductionSchedule] ADD  CONSTRAINT [DF_ProductionSchedule_inspection_flg]  DEFAULT ((0)) FOR [inspection_flg]
GO
ALTER TABLE [dbo].[ProductionSchedule] ADD  CONSTRAINT [DF_ProductionSchedule_uncontrol_flg]  DEFAULT ((0)) FOR [uncontrol_flg]
GO
ALTER TABLE [dbo].[ProductionSchedule] ADD  CONSTRAINT [DF_ProductionSchedule_create_dt]  DEFAULT (sysdatetime()) FOR [create_dt]
GO
ALTER TABLE [dbo].[ProductionSchedule] ADD  CONSTRAINT [DF_ProductionSchedule_update_dt]  DEFAULT (sysdatetime()) FOR [update_dt]
GO
ALTER TABLE [dbo].[ProductionSchedule] ADD  CONSTRAINT [DF_ProductionSchedule_confirm_flg]  DEFAULT ((0)) FOR [confirm_flg]
GO
ALTER TABLE [dbo].[Stock] ADD  CONSTRAINT [DF_Stock_carry_over]  DEFAULT ((0)) FOR [carry_over]
GO
ALTER TABLE [dbo].[Stock] ADD  CONSTRAINT [DF_Stock_qty]  DEFAULT ((0)) FOR [qty]
GO
ALTER TABLE [dbo].[Stock] ADD  CONSTRAINT [DF_Stock_hold_flg]  DEFAULT ((0)) FOR [hold_qty]
GO
ALTER TABLE [dbo].[Stock] ADD  CONSTRAINT [DF_Stock_reserve_qty]  DEFAULT ((0)) FOR [reserve_qty]
GO
ALTER TABLE [dbo].[Stock] ADD  CONSTRAINT [DF_Stock_create_dt]  DEFAULT (sysdatetime()) FOR [create_dt]
GO
ALTER TABLE [dbo].[Stock] ADD  CONSTRAINT [DF_Stock_update_dt]  DEFAULT (sysdatetime()) FOR [update_dt]
GO
ALTER TABLE [dbo].[Stocktaking] ADD  CONSTRAINT [DF_Stocktaking_status]  DEFAULT ((0)) FOR [status]
GO
ALTER TABLE [dbo].[Stocktaking] ADD  CONSTRAINT [DF_Stocktaking_qty]  DEFAULT ((0)) FOR [qty]
GO
ALTER TABLE [dbo].[Stocktaking] ADD  CONSTRAINT [DF_Stocktaking_create_dt]  DEFAULT (sysdatetime()) FOR [create_dt]
GO
ALTER TABLE [dbo].[Stocktaking] ADD  CONSTRAINT [DF_Stocktaking_update_dt]  DEFAULT (sysdatetime()) FOR [update_dt]
GO
ALTER TABLE [dbo].[Stocktaking] ADD  CONSTRAINT [DF_Stocktaking_division]  DEFAULT ((1)) FOR [division]
GO
ALTER TABLE [dbo].[StockTracking] ADD  CONSTRAINT [DF_StockTracking_create_dt]  DEFAULT (sysdatetime()) FOR [create_dt]
GO
ALTER TABLE [dbo].[StockTracking] ADD  CONSTRAINT [DF_StockTracking_update_dt]  DEFAULT (sysdatetime()) FOR [update_dt]
GO
ALTER TABLE [dbo].[Supplier] ADD  DEFAULT (sysdatetime()) FOR [create_dt]
GO
ALTER TABLE [dbo].[Supplier] ADD  DEFAULT (sysdatetime()) FOR [update_dt]
GO
ALTER TABLE [dbo].[UserCredential] ADD  DEFAULT (sysdatetime()) FOR [create_dt]
GO
ALTER TABLE [dbo].[UserCredential] ADD  DEFAULT (sysdatetime()) FOR [update_dt]
GO
ALTER TABLE [dbo].[Users] ADD  DEFAULT (sysdatetime()) FOR [create_dt]
GO
ALTER TABLE [dbo].[Users] ADD  DEFAULT (sysdatetime()) FOR [update_dt]
GO
ALTER TABLE [dbo].[Kanban]  WITH CHECK ADD  CONSTRAINT [CK_status] CHECK  (([status]=(1) OR [status]=(0)))
GO
ALTER TABLE [dbo].[Kanban] CHECK CONSTRAINT [CK_status]
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'status 1 = Normal, status 2 = Templary' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Kanban', @level2type=N'COLUMN',@level2name=N'kanban_class'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'status 1 = Normal, status 2 = Remainder ' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Kanban', @level2type=N'COLUMN',@level2name=N'remainder_class'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'status 0 = Not Using, status 1 = Using ' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Kanban', @level2type=N'COLUMN',@level2name=N'status'
GO
