-- Kaid :  dbo.mold_bind_log 增加欄位 moldtid TINYINT default value = 0

UPDATE [dbo].[cfnc]
SET
	fncname = des
GO
ALTER TABLE [dbo].[ceqps] DROP CONSTRAINT [DF_c_eqps_create_dt]
GO
/****** Object:  Table [dbo].[cmolds]    Script Date: 2026/7/29 下午 03:23:44 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[cmolds]') AND type in (N'U'))
DROP TABLE [dbo].[cmolds]
GO
/****** Object:  Table [dbo].[ceqps]    Script Date: 2026/7/29 下午 03:23:44 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[ceqps]') AND type in (N'U'))
DROP TABLE [dbo].[ceqps]
GO
/****** Object:  Table [dbo].[ceqps]    Script Date: 2026/7/29 下午 03:23:44 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ceqps](
	[eqpsid] [tinyint] IDENTITY(1,1) NOT NULL,
	[eqpsno] [nvarchar](50) NULL,
	[eqpsname] [nvarchar](50) NULL,
	[is_delete] [bit] NULL,
	[color] [nvarchar](50) NULL,
	[color_hex] [nvarchar](50) NULL,
	[update_dt] [datetime] NULL,
	[update_uid] [smallint] NULL,
	[create_dt] [datetime] NOT NULL,
	[create_uid] [smallint] NULL,
 CONSTRAINT [PK_ct_equip_state] PRIMARY KEY CLUSTERED 
(
	[eqpsid] 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 [SECONDARY]
) ON [SECONDARY]
GO
/****** Object:  Table [dbo].[cmolds]    Script Date: 2026/7/29 下午 03:23:44 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[cmolds](
	[moldsid] [tinyint] IDENTITY(1,1) NOT NULL,
	[mdsname] [nvarchar](50) NOT NULL,
	[remark] [nvarchar](50) NULL,
 CONSTRAINT [PK_cmolds] PRIMARY KEY CLUSTERED 
(
	[moldsid] 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
SET IDENTITY_INSERT [dbo].[ceqps] ON 

INSERT [dbo].[ceqps] ([eqpsid], [eqpsno], [eqpsname], [is_delete], [color], [color_hex], [update_dt], [update_uid], [create_dt], [create_uid]) VALUES (1, N'Standby', N'待機', 0, N'Blue', N'#0000FF', CAST(N'2026-05-07T09:50:27.310' AS DateTime), -1, CAST(N'2026-05-07T09:50:27.310' AS DateTime), -1)
INSERT [dbo].[ceqps] ([eqpsid], [eqpsno], [eqpsname], [is_delete], [color], [color_hex], [update_dt], [update_uid], [create_dt], [create_uid]) VALUES (2, N'Processing', N'運轉中', 0, N'Green', N'#008000', CAST(N'2026-05-07T09:56:07.860' AS DateTime), -1, CAST(N'2026-05-07T09:56:07.860' AS DateTime), -1)
INSERT [dbo].[ceqps] ([eqpsid], [eqpsno], [eqpsname], [is_delete], [color], [color_hex], [update_dt], [update_uid], [create_dt], [create_uid]) VALUES (3, N'Malfunction', N'故障', 0, N'Red', N'#880808', CAST(N'2026-05-07T09:58:03.673' AS DateTime), -1, CAST(N'2026-05-07T09:58:03.673' AS DateTime), -1)
INSERT [dbo].[ceqps] ([eqpsid], [eqpsno], [eqpsname], [is_delete], [color], [color_hex], [update_dt], [update_uid], [create_dt], [create_uid]) VALUES (4, N'Maintain', N'維護', 0, N'Orange', N'#FFBF00', CAST(N'2026-05-07T09:58:29.607' AS DateTime), -1, CAST(N'2026-05-07T09:58:29.607' AS DateTime), -1)
INSERT [dbo].[ceqps] ([eqpsid], [eqpsno], [eqpsname], [is_delete], [color], [color_hex], [update_dt], [update_uid], [create_dt], [create_uid]) VALUES (5, N'Online', N'上線', 0, N'GREEN', N'#008000', NULL, -1, CAST(N'2026-07-24T17:07:15.007' AS DateTime), -1)
INSERT [dbo].[ceqps] ([eqpsid], [eqpsno], [eqpsname], [is_delete], [color], [color_hex], [update_dt], [update_uid], [create_dt], [create_uid]) VALUES (6, N'Offline', N'下線', 0, N'Red', N'#880808', NULL, -1, CAST(N'2026-07-24T17:07:42.070' AS DateTime), -1)
INSERT [dbo].[ceqps] ([eqpsid], [eqpsno], [eqpsname], [is_delete], [color], [color_hex], [update_dt], [update_uid], [create_dt], [create_uid]) VALUES (7, N'Warming', N'調機(暖機)', 0, N'Orange', N'#FFBF00', NULL, -1, CAST(N'2026-07-24T17:08:31.213' AS DateTime), -1)
INSERT [dbo].[ceqps] ([eqpsid], [eqpsno], [eqpsname], [is_delete], [color], [color_hex], [update_dt], [update_uid], [create_dt], [create_uid]) VALUES (8, N'Renting', N'借機', 0, N'Red', N'#880808', NULL, -1, CAST(N'2026-07-24T17:09:32.630' AS DateTime), -1)
INSERT [dbo].[ceqps] ([eqpsid], [eqpsno], [eqpsname], [is_delete], [color], [color_hex], [update_dt], [update_uid], [create_dt], [create_uid]) VALUES (9, N'Maintenance', N'保養', 0, N'Orange', N'#FFBF00', NULL, -1, CAST(N'2026-07-24T17:10:26.960' AS DateTime), -1)
INSERT [dbo].[ceqps] ([eqpsid], [eqpsno], [eqpsname], [is_delete], [color], [color_hex], [update_dt], [update_uid], [create_dt], [create_uid]) VALUES (10, N'Waiting', N'備機', 0, N'Blue', N'#0000FF', NULL, -1, CAST(N'2026-07-24T17:11:30.647' AS DateTime), -1)
SET IDENTITY_INSERT [dbo].[ceqps] OFF
GO
SET IDENTITY_INSERT [dbo].[cmolds] ON 

INSERT [dbo].[cmolds] ([moldsid], [mdsname], [remark]) VALUES (1, N'良好', NULL)
INSERT [dbo].[cmolds] ([moldsid], [mdsname], [remark]) VALUES (2, N'需研磨', NULL)
INSERT [dbo].[cmolds] ([moldsid], [mdsname], [remark]) VALUES (3, N'報廢', NULL)
INSERT [dbo].[cmolds] ([moldsid], [mdsname], [remark]) VALUES (4, N'已綁定', NULL)
SET IDENTITY_INSERT [dbo].[cmolds] OFF
GO
ALTER TABLE [dbo].[ceqps] ADD  CONSTRAINT [DF_c_eqps_create_dt]  DEFAULT (getdate()) FOR [create_dt]
GO
