/* 脚本导出时间:2026/08/18 14:45:07 */ /* 脚本导出人员:系统管理员 */ /* 脚本 说明:T_BD_BOM BOM单*/ -- DROP TABLE T_BD_BOM IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'T_BD_BOM') AND type in (N'U')) BEGIN CREATE TABLE T_BD_BOM( FDATE DATE NULL , -- BOM单据日期 FBOMSKIP INT NOT NULL DEFAULT 0 , -- 跳层 FAUXQTY DECIMAL(24,6) NOT NULL DEFAULT 0 , -- 用量 FBASEUNITID VARCHAR(50) NOT NULL DEFAULT '' , -- 基本单位 FQTY DECIMAL(24,6) NOT NULL DEFAULT 0 , -- 基本单位数量 FMATERIALID VARCHAR(50) NOT NULL DEFAULT '' , -- 物料内码 FERPCLSID VARCHAR(50) NOT NULL DEFAULT '' , -- 物料属性 FMODEL VARCHAR(50) NOT NULL DEFAULT '' , -- 规格型号 FYIELD DECIMAL(24,6) NOT NULL DEFAULT 0 , -- 成品率 FVERSION NVARCHAR(50) NOT NULL DEFAULT '' , -- 版本 FCUSTID VARCHAR(50) NOT NULL DEFAULT '' , -- 客户内码 FCUSTITEMID NVARCHAR(50) NOT NULL DEFAULT '' , -- 客户料号内码 FCHARTNUMBER VARCHAR(50) NOT NULL DEFAULT '' , -- 图号 FNOTE VARCHAR(50) NOT NULL DEFAULT '' , -- 备注 FCHECKERID VARCHAR(50) NOT NULL DEFAULT '' , -- 审核人 FCHECKDATE DATETIME NULL , -- 审核日期 FDISABLEID VARCHAR(50) NOT NULL DEFAULT '' , -- 禁用人 FDISABLEDATE DATETIME NULL , -- 禁用日期 FAUXPROPID VARCHAR(50) NOT NULL DEFAULT '' , -- 辅助属性 FINTERID VARCHAR(50) NOT NULL DEFAULT '', -- 表内码 FBILLNO VARCHAR(50) NOT NULL DEFAULT '', -- BOM版本 FGROUPID VARCHAR(50) NOT NULL DEFAULT '', -- 分组内码 FSTATUS INT NOT NULL DEFAULT 0 , -- 状态 FDELETED BIT NOT NULL DEFAULT 0 , --禁用状态 0 = 正常 1 = 禁用 FCOMPANYID VARCHAR(50) NOT NULL DEFAULT '', -- 组织代码 C_YMD DATETIME NULL, -- 资料创建日期 C_USER VARCHAR(20) NOT NULL DEFAULT '', -- 资料创建帐号 M_YMD DATETIME NULL, -- 最后异动日期 M_USER VARCHAR(20) NOT NULL DEFAULT '', -- 最后异动帐号 UID VARCHAR(50) NOT NULL CONSTRAINT [PK_T_BD_BOM] PRIMARY KEY NONCLUSTERED ) END ELSE BEGIN if(not exists(select name from SysColumns where name ='FDATE' and id= OBJECT_ID('T_BD_BOM'))) Alter Table T_BD_BOM add FDATE DATE NULL -- BOM单据日期 if(not exists(select name from SysColumns where name ='FBOMSKIP' and id= OBJECT_ID('T_BD_BOM'))) Alter Table T_BD_BOM add FBOMSKIP INT NOT NULL DEFAULT 0 -- 跳层 if(not exists(select name from SysColumns where name ='FAUXQTY' and id= OBJECT_ID('T_BD_BOM'))) Alter Table T_BD_BOM add FAUXQTY DECIMAL(24,6) NOT NULL DEFAULT 0 -- 用量 if(not exists(select name from SysColumns where name ='FBASEUNITID' and id= OBJECT_ID('T_BD_BOM'))) Alter Table T_BD_BOM add FBASEUNITID VARCHAR(50) NOT NULL DEFAULT '' -- 基本单位 if(not exists(select name from SysColumns where name ='FQTY' and id= OBJECT_ID('T_BD_BOM'))) Alter Table T_BD_BOM add FQTY DECIMAL(24,6) NOT NULL DEFAULT 0 -- 基本单位数量 if(not exists(select name from SysColumns where name ='FMATERIALID' and id= OBJECT_ID('T_BD_BOM'))) Alter Table T_BD_BOM add FMATERIALID VARCHAR(50) NOT NULL DEFAULT '' -- 物料内码 if(not exists(select name from SysColumns where name ='FERPCLSID' and id= OBJECT_ID('T_BD_BOM'))) Alter Table T_BD_BOM add FERPCLSID VARCHAR(50) NOT NULL DEFAULT '' -- 物料属性 if(not exists(select name from SysColumns where name ='FMODEL' and id= OBJECT_ID('T_BD_BOM'))) Alter Table T_BD_BOM add FMODEL VARCHAR(50) NOT NULL DEFAULT '' -- 规格型号 if(not exists(select name from SysColumns where name ='FYIELD' and id= OBJECT_ID('T_BD_BOM'))) Alter Table T_BD_BOM add FYIELD DECIMAL(24,6) NOT NULL DEFAULT 0 -- 成品率 if(not exists(select name from SysColumns where name ='FVERSION' and id= OBJECT_ID('T_BD_BOM'))) Alter Table T_BD_BOM add FVERSION NVARCHAR(50) NOT NULL DEFAULT '' -- 版本 if(not exists(select name from SysColumns where name ='FCUSTID' and id= OBJECT_ID('T_BD_BOM'))) Alter Table T_BD_BOM add FCUSTID VARCHAR(50) NOT NULL DEFAULT '' -- 客户内码 if(not exists(select name from SysColumns where name ='FCUSTITEMID' and id= OBJECT_ID('T_BD_BOM'))) Alter Table T_BD_BOM add FCUSTITEMID NVARCHAR(50) NOT NULL DEFAULT '' -- 客户料号内码 if(not exists(select name from SysColumns where name ='FCHARTNUMBER ' and id= OBJECT_ID('T_BD_BOM'))) Alter Table T_BD_BOM add FCHARTNUMBER VARCHAR(50) NOT NULL DEFAULT '' -- 图号 if(not exists(select name from SysColumns where name ='FNOTE' and id= OBJECT_ID('T_BD_BOM'))) Alter Table T_BD_BOM add FNOTE VARCHAR(50) NOT NULL DEFAULT '' -- 备注 if(not exists(select name from SysColumns where name ='FCHECKERID' and id= OBJECT_ID('T_BD_BOM'))) Alter Table T_BD_BOM add FCHECKERID VARCHAR(50) NOT NULL DEFAULT '' -- 审核人 if(not exists(select name from SysColumns where name ='FCHECKDATE' and id= OBJECT_ID('T_BD_BOM'))) Alter Table T_BD_BOM add FCHECKDATE DATETIME NULL -- 审核日期 if(not exists(select name from SysColumns where name ='FDISABLEID' and id= OBJECT_ID('T_BD_BOM'))) Alter Table T_BD_BOM add FDISABLEID VARCHAR(50) NOT NULL DEFAULT '' -- 禁用人 if(not exists(select name from SysColumns where name ='FDISABLEDATE' and id= OBJECT_ID('T_BD_BOM'))) Alter Table T_BD_BOM add FDISABLEDATE DATETIME NULL -- 禁用日期 if(not exists(select name from SysColumns where name ='FAUXPROPID' and id= OBJECT_ID('T_BD_BOM'))) Alter Table T_BD_BOM add FAUXPROPID VARCHAR(50) NOT NULL DEFAULT '' -- 辅助属性 if(not exists(select name from SysColumns where name ='FCOMPANYID' and id= OBJECT_ID('T_BD_BOM'))) Alter Table T_BD_BOM add FCOMPANYID VARCHAR(50) NOT NULL DEFAULT '' -- 组织代码 if(not exists(select name from SysColumns where name ='FINTERID' and id= OBJECT_ID('T_BD_BOM'))) Alter Table T_BD_BOM add FINTERID VARCHAR(50) NOT NULL DEFAULT '' -- 表内码 if(not exists(select name from SysColumns where name ='FBILLNO' and id= OBJECT_ID('T_BD_BOM'))) Alter Table T_BD_BOM add FBILLNO VARCHAR(50) NOT NULL DEFAULT '' -- 单据编号 if(not exists(select name from SysColumns where name ='FGROUPID' and id= OBJECT_ID('T_BD_BOM'))) Alter Table T_BD_BOM add FGROUPID VARCHAR(50) NOT NULL DEFAULT '' -- 分组内码 END GO -- IF EXISTS (SELECT * FROM sysindexes WHERE id = OBJECT_ID(N'T_BD_BOM') AND name = N'T_BD_BOM_1' ) Drop Index T_BD_BOM.T_BD_BOM_1 GO Create unique index T_BD_BOM_1 on T_BD_BOM(FINTERID) GO -- IF EXISTS (SELECT * FROM sysindexes WHERE id = OBJECT_ID(N'T_BD_BOM') AND name = N'T_BD_BOM_2' ) Drop Index T_BD_BOM.T_BD_BOM_2 GO Create Clustered index T_BD_BOM_2 on T_BD_BOM(FBILLNO) GO GO