ERP数据库模型设计.SQL 40 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314
  1. SELECT count(*)
  2. FROM sys.sysobjects
  3. WHERE (type = 'u')
  4. GO
  5. --创建数据库的SQL语句:
  6. create database LYFZERPDB
  7. on --primary -- 默认就属于primary文件组,可省略
  8. (
  9. /*--数据文件的具体描述--*/
  10. name='LYFZERPDB_data', -- 主数据文件的逻辑名称
  11. filename='D:\LYFZ_File\DB\LYFZERPDB_data.mdf', -- 主数据文件的物理名称
  12. size=5mb, --主数据文件的初始大小
  13. --maxsize=100mb, -- 主数据文件增长的最大值
  14. filegrowth=15%--主数据文件的增长率
  15. )
  16. log on
  17. (
  18. /*--日志文件的具体描述,各参数含义同上--*/
  19. name='LYFZERPDB_log',
  20. filename='D:\LYFZ_File\DB\LYFZERPDB_log.ldf',
  21. size=2mb,
  22. filegrowth=1mb
  23. )
  24. IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[tb_ErpUser]') AND type in (N'U'))
  25. DROP TABLE [dbo].[tb_ErpUser]
  26. GO
  27. CREATE TABLE [dbo].[tb_ErpUser] (
  28. [ID] int identity NOT NULL
  29. , [User_Account] nvarchar(20) NOT NULL
  30. , [User_Name] nvarchar(20) NOT NULL
  31. , [User_Password] nvarchar(100) NOT NULL
  32. , [User_EmployeeID] nvarchar(20) NOT NULL
  33. , [User_Department] nvarchar(20) NOT NULL
  34. , [User_Positions] nvarchar(20) NOT NULL
  35. , [User_Competence] nvarchar(200) NOT NULL
  36. , [User_OnlineTime] datetime NOT NULL
  37. , [User_Sex] nvarchar(2) NOT NULL
  38. , [User_Status] nvarchar(10) NOT NULL
  39. , [User_IsDisable] bit NOT NULL
  40. , [User_Ethnic] nvarchar(50) NOT NULL
  41. , [User_Hometown] nvarchar(50) NOT NULL
  42. , [User_NowAddress] nvarchar(200) NOT NULL
  43. , [User_IdentityCardID] nvarchar(50) NOT NULL
  44. , [User_HometownAddress] nvarchar(200) NOT NULL
  45. , [User_IsMarried] bit NOT NULL
  46. , [User_FirstFingerprintID] nvarchar(20) NOT NULL
  47. , [User_SecondaryFingerprintID] nvarchar(20) NOT NULL
  48. , [User_ICQAccount] nvarchar(50) NOT NULL
  49. , [User_Email] nvarchar(100) NOT NULL
  50. , [User_MicroSignal] nvarchar(100) NOT NULL
  51. , [User_Attachment] nvarchar(800) NOT NULL
  52. , [User_Remark] nvarchar(800) NOT NULL
  53. , [User_CreateDatetime] datetime NOT NULL
  54. , [User_UpdateDatetime] datetime NOT NULL
  55. , [User_SubordinateList] nvarchar(2000) NOT NULL
  56. , [User_Telephone] nvarchar(20) NOT NULL
  57. , [User_CustomerID] int NOT NULL
  58. )
  59. GO
  60. ALTER TABLE [dbo].[tb_ErpUser] ADD CONSTRAINT [tb_ErpUser_PK] PRIMARY KEY CLUSTERED (
  61. [User_Account]
  62. )
  63. GO
  64. GO
  65. IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[tb_ErpTheScenery]') AND type in (N'U'))
  66. DROP TABLE [dbo].[tb_ErpTheScenery]
  67. GO
  68. CREATE TABLE [dbo].[tb_ErpTheScenery] (
  69. [ID] int identity NOT NULL
  70. , [Tsc_Name] nvarchar(200) NOT NULL
  71. , [Tsc_Introduction] nvarchar(800) NOT NULL
  72. , [Tsc_DetailsOf] text NULL
  73. , [Tsc_Address] nvarchar(100) NULL
  74. , [Tsc_CostPrice] decimal(10,2) NOT NULL
  75. , [Tsc_SalesPrice] decimal(10,2) NULL
  76. , [Tsc_Remark] nvarchar(800) NULL
  77. , [Tsc_Thumbnail] nvarchar(800) NULL
  78. , [Tsc_PhotoAlbum] nvarchar(800) NULL
  79. , [Tsc_IsDisable] bit NOT NULL
  80. , [Tsc_CreateDatetime] datetime NOT NULL
  81. , [Tsc_UpdateDatetime] datetime NOT NULL
  82. )
  83. GO
  84. ALTER TABLE [dbo].[tb_ErpTheScenery] ADD CONSTRAINT [tb_ErpTheScenery_PK] PRIMARY KEY CLUSTERED (
  85. [ID]
  86. )
  87. GO
  88. GO
  89. IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[tb_ErpOrderProductList]') AND type in (N'U'))
  90. DROP TABLE [dbo].[tb_ErpOrderProductList]
  91. GO
  92. CREATE TABLE [dbo].[tb_ErpOrderProductList] (
  93. [ID] int identity NOT NULL
  94. , [OPlist_OrderNumber] nvarchar(20) NOT NULL
  95. , [OPlist_ProdClassCode] nvarchar(10) NOT NULL
  96. , [OPlist_ProdClassName] nvarchar(100) NULL
  97. , [OPlist_MainPhoto] nvarchar(200) NULL
  98. , [OPlist_ProdNumber] nvarchar(100) NOT NULL
  99. , [OPlist_ProdName] nvarchar(100) NOT NULL
  100. , [OPlist_ProdCostPrice] decimal(10,2) NOT NULL
  101. , [OPlist_ProdSoldPrice] decimal(10,2) NOT NULL
  102. , [OPlist_ProdQuantity] int NOT NULL
  103. , [OPlist_ProdThumbnail] nvarchar(800) NULL
  104. , [OPlist_Remark] nvarchar(800) NULL
  105. , [OPlist_CreateDatetime] datetime NULL
  106. , [OPlist_Type] nvarchar(20) NOT NULL
  107. )
  108. GO
  109. ALTER TABLE [dbo].[tb_ErpOrderProductList] ADD CONSTRAINT [tb_ErpOrderProductList_PK] PRIMARY KEY CLUSTERED (
  110. [ID]
  111. )
  112. GO
  113. GO
  114. IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[tb_ErpInformation]') AND type in (N'U'))
  115. DROP TABLE [dbo].[tb_ErpInformation]
  116. GO
  117. CREATE TABLE [dbo].[tb_ErpInformation] (
  118. [ID] int identity NOT NULL
  119. , [Info_Type] nvarchar(20) NOT NULL
  120. , [Info_Category] nvarchar(100) NOT NULL
  121. , [Info_ParentID] int NULL
  122. , [Info_Title] nvarchar(200) NOT NULL
  123. , [Info_ChlidTitle] nvarchar(200) NULL
  124. , [Info_Introduction] nvarchar(800) NULL
  125. , [Info_Content] text NOT NULL
  126. , [Info_Plotting] nvarchar(200) NULL
  127. , [Info_Attachment] nvarchar(800) NULL
  128. , [Info_Source] nvarchar(200) NULL
  129. , [Info_Editing] nvarchar(20) NULL
  130. , [Info_Publisher] nvarchar(20) NULL
  131. , [Info_ClickRate] int NULL
  132. , [Info_IsEnabled] bit NULL
  133. , [Info_IsExamine] bit NULL
  134. , [Info_Remark] nvarchar(800) NULL
  135. , [Info_Order] int NOT NULL
  136. , [Info_ExamineName] nvarchar(20) NULL
  137. , [Info_URL] nvarchar(500) NULL
  138. , [Info_IsEnabledURL] bit NULL
  139. , [Info_IsDelete] bit NULL
  140. , [Info_CreateDatetime] datetime NOT NULL
  141. , [Info_UpdateDatetime] datetime NOT NULL
  142. )
  143. GO
  144. ALTER TABLE [dbo].[tb_ErpInformation] ADD CONSTRAINT [tb_ErpInformation_PK] PRIMARY KEY CLUSTERED (
  145. [ID]
  146. )
  147. GO
  148. GO
  149. IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[tb_ErpProduct]') AND type in (N'U'))
  150. DROP TABLE [dbo].[tb_ErpProduct]
  151. GO
  152. CREATE TABLE [dbo].[tb_ErpProduct] (
  153. [ID] int identity NOT NULL
  154. , [Prod_Number] nvarchar(20) NOT NULL
  155. , [Prod_Name] nvarchar(100) NOT NULL
  156. , [Prod_Class] nvarchar(100) NOT NULL
  157. , [Prod_Unit] nvarchar(10) NOT NULL
  158. , [Prod_CostPrice] decimal(10,2) NOT NULL
  159. , [Prod_SalesPrice ] decimal(10,2) NOT NULL
  160. , [Prod_SpecialPrice] decimal(10,2) NULL
  161. , [Prod_PurchasePrice] decimal(10,2) NOT NULL
  162. , [Prod_IsRetail] bit NOT NULL
  163. , [Prod_IsEnabled] bit NOT NULL
  164. , [Prod_Introduction] nvarchar(800) NULL
  165. , [Prod_Detail] text NULL
  166. , [Prod_Remark] nvarchar(800) NULL
  167. , [Prod_Quantity] int NOT NULL
  168. , [Prod_Thumbnail] nvarchar(800) NULL
  169. , [Prod_FullSizeImage] nvarchar(800) NULL
  170. , [Prod_CreateDatetime] datetime NOT NULL
  171. , [Prod_UpdateDatetime] datetime NOT NULL
  172. )
  173. GO
  174. ALTER TABLE [dbo].[tb_ErpProduct] ADD CONSTRAINT [tb_ErpProduct_PK] PRIMARY KEY CLUSTERED (
  175. [Prod_Number]
  176. )
  177. GO
  178. GO
  179. IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[tb_ErpAttendanceRecord]') AND type in (N'U'))
  180. DROP TABLE [dbo].[tb_ErpAttendanceRecord]
  181. GO
  182. CREATE TABLE [dbo].[tb_ErpAttendanceRecord] (
  183. [ID] int identity NOT NULL
  184. , [Ar_FingerprintID] nvarchar(100) NOT NULL
  185. , [Ar_UserID] nvarchar(20) NOT NULL
  186. , [Ar_UserName] nvarchar(20) NULL
  187. , [Ar_ArriveIate] nvarchar(100) NULL
  188. , [Ar_LeaveEarly] nvarchar(100) NULL
  189. , [Ar_Absenteeism] nvarchar(100) NULL
  190. , [Ar_AskForleave] nvarchar(100) NULL
  191. , [Ar_Day1] nvarchar(50) NULL
  192. , [Ar_Day2] nvarchar(50) NULL
  193. , [Ar_Day3] nvarchar(50) NULL
  194. , [Ar_Day4] nvarchar(50) NULL
  195. , [Ar_Day5] nvarchar(50) NULL
  196. , [Ar_Day6] nvarchar(50) NULL
  197. , [Ar_Day7] nvarchar(50) NULL
  198. , [Ar_Day8] nvarchar(50) NULL
  199. , [Ar_Day9] nvarchar(50) NULL
  200. , [Ar_Day10] nvarchar(50) NULL
  201. , [Ar_Day11] nvarchar(50) NULL
  202. , [Ar_Day12] nvarchar(50) NULL
  203. , [Ar_Day13] nvarchar(50) NULL
  204. , [Ar_Day14] nvarchar(50) NULL
  205. , [Ar_Day15] nvarchar(50) NULL
  206. , [Ar_Day16] nvarchar(50) NULL
  207. , [Ar_Day17] nvarchar(50) NULL
  208. , [Ar_Day18] nvarchar(50) NULL
  209. , [Ar_Day19] nvarchar(50) NULL
  210. , [Ar_Day20] nvarchar(50) NULL
  211. , [Ar_Day21] nvarchar(50) NULL
  212. , [Ar_Day22] nvarchar(50) NULL
  213. , [Ar_Day23] nvarchar(50) NULL
  214. , [Ar_Day24] nvarchar(50) NULL
  215. , [Ar_Day25] nvarchar(50) NULL
  216. , [Ar_Day26] nvarchar(50) NULL
  217. , [Ar_Day27] nvarchar(50) NULL
  218. , [Ar_Day28] nvarchar(50) NULL
  219. , [Ar_Day29] nvarchar(50) NULL
  220. , [Ar_Day30] nvarchar(50) NULL
  221. , [Ar_Day31] nvarchar(50) NULL
  222. , [Ar_Type] nvarchar(20) NULL
  223. , [Ar_Month] int NULL
  224. )
  225. GO
  226. ALTER TABLE [dbo].[tb_ErpAttendanceRecord] ADD CONSTRAINT [tb_ErpAttendanceRecord_PK] PRIMARY KEY CLUSTERED (
  227. [ID]
  228. )
  229. GO
  230. GO
  231. IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[tb_ErpInternalMail]') AND type in (N'U'))
  232. DROP TABLE [dbo].[tb_ErpInternalMail]
  233. GO
  234. CREATE TABLE [dbo].[tb_ErpInternalMail] (
  235. [ID] int identity NOT NULL
  236. , [Imail_Type] nvarchar(20) NULL
  237. , [Imail_Title] nvarchar(100) NOT NULL
  238. , [Imail_Content] text NOT NULL
  239. , [Imail_FromName] nvarchar(20) NOT NULL
  240. , [Imail_ToName] nvarchar(4000) NOT NULL
  241. , [Imail_Attachment] nvarchar(800) NULL
  242. , [Imail_Status] nvarchar(20) NOT NULL
  243. , [Imail_ReadList] nvarchar(4000) NULL
  244. , [Imail_OwnerList] nvarchar(4000) NULL
  245. , [Imail_ToSendDatetime] datetime NOT NULL
  246. , [Imail_DeleteList] nvarchar(4000) NOT NULL
  247. , [Imail_CreateDatetime] datetime NOT NULL
  248. , [Imail_UpdateDatetime] datetime NOT NULL
  249. )
  250. GO
  251. ALTER TABLE [dbo].[tb_ErpInternalMail] ADD CONSTRAINT [tb_ErpInternalMail_PK] PRIMARY KEY CLUSTERED (
  252. [ID]
  253. )
  254. GO
  255. GO
  256. IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[tb_ErpPayment]') AND type in (N'U'))
  257. DROP TABLE [dbo].[tb_ErpPayment]
  258. GO
  259. CREATE TABLE [dbo].[tb_ErpPayment] (
  260. [ID] int identity NOT NULL
  261. , [Pay_OrdNumber] nvarchar(20) NOT NULL
  262. , [Pay_AmountOf] decimal(10,2) NOT NULL
  263. , [Pay_OpenSingle] nvarchar(20) NOT NULL
  264. , [Pay_ThePayee] nvarchar(20) NOT NULL
  265. , [Pay_PaymentMethod] nvarchar(50) NOT NULL
  266. , [Pay_OrdersLocation] nvarchar(100) NOT NULL
  267. , [Pay_ReceivableProject] nvarchar(500) NOT NULL
  268. , [Pay_Remark] nvarchar(800) NULL
  269. , [Pay_CreateDatetime] datetime NOT NULL
  270. )
  271. GO
  272. ALTER TABLE [dbo].[tb_ErpPayment] ADD CONSTRAINT [tb_ErpPayment_PK] PRIMARY KEY CLUSTERED (
  273. [ID]
  274. )
  275. GO
  276. GO
  277. IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[tb_ErpMembershipCard]') AND type in (N'U'))
  278. DROP TABLE [dbo].[tb_ErpMembershipCard]
  279. GO
  280. CREATE TABLE [dbo].[tb_ErpMembershipCard] (
  281. [ID] int identity NOT NULL
  282. , [Mc_Number] nvarchar(50) NOT NULL
  283. , [Mc_IdentityCardID] nvarchar(30) NULL
  284. , [Mc_Name] nvarchar(20) NULL
  285. , [Mc_Sex] bit NULL
  286. , [Mc_Telephone] nvarchar(20) NULL
  287. , [Mc_QQ] nvarchar(20) NULL
  288. , [Mc_Address] nvarchar(100) NULL
  289. , [Mc_WorkUnit] nvarchar(100) NULL
  290. , [MC_Birthday] nvarchar(20) NULL
  291. , [Mc_CardType] nvarchar(20) NULL
  292. , [Mc_CardLevel] nvarchar(10) NULL
  293. , [Mc_Discount] decimal(10,2) NULL
  294. , [Mc_Points] int NULL
  295. , [Mc_IssuingDate] datetime NULL
  296. , [Mc_RecyclingDate] datetime NULL
  297. , [Mc_Remark] nvarchar(800) NULL
  298. , [Mc_Status] nvarchar(20) NULL
  299. , [Mc_ParentID] int NULL
  300. , [Mc_ConsumerPassword] nvarchar(100) NULL
  301. , [Mc_Money] decimal(10,2) NULL
  302. , [Mc_Profession] nvarchar(100) NULL
  303. , [Mc_PackagesMoney] decimal(10,2) NULL
  304. , [Mc_AvailableCashBack] decimal(10,2) NULL
  305. , [Mc_AlreadyCashBack] decimal(10,2) NULL
  306. , [Mc_CreateDatetime] datetime NULL
  307. , [Mc_UpdateDateTime] datetime NULL
  308. )
  309. GO
  310. ALTER TABLE [dbo].[tb_ErpMembershipCard] ADD CONSTRAINT [tb_ErpMembershipCard_PK] PRIMARY KEY CLUSTERED (
  311. [Mc_Number]
  312. )
  313. GO
  314. GO
  315. IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[tb_ErpFixedAssetManagement]') AND type in (N'U'))
  316. DROP TABLE [dbo].[tb_ErpFixedAssetManagement]
  317. GO
  318. CREATE TABLE [dbo].[tb_ErpFixedAssetManagement] (
  319. [ID] int NOT NULL
  320. , [Fam_Name] nvarchar(200) NOT NULL
  321. , [Fam_Specification] nvarchar(500) NOT NULL
  322. , [Fam_Quantity] int NOT NULL
  323. , [Fam_PurchasePrice] decimal(10,2) NULL
  324. , [Fam_BuyDatetime] datetime NULL
  325. , [Fam_Custodian] nvarchar(20) NULL
  326. , [Fam_Remark] nvarchar(800) NULL
  327. , [Fam_PhotoAlbum] nvarchar(2000) NULL
  328. , [Fam_CreateDatetime] datetime NULL
  329. , [Fam_UpdateDatetime] datetime NULL
  330. )
  331. GO
  332. ALTER TABLE [dbo].[tb_ErpFixedAssetManagement] ADD CONSTRAINT [tb_ErpFixedAssetManagement_PK] PRIMARY KEY CLUSTERED (
  333. [ID]
  334. )
  335. GO
  336. GO
  337. IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[tb_ErpSystemLogs]') AND type in (N'U'))
  338. DROP TABLE [dbo].[tb_ErpSystemLogs]
  339. GO
  340. CREATE TABLE [dbo].[tb_ErpSystemLogs] (
  341. [ID] int identity NOT NULL
  342. , [Slogs_Type] nvarchar(10) NOT NULL
  343. , [Slogs_Topic] nvarchar(200) NOT NULL
  344. , [Slogs_Content] nvarchar(500) NOT NULL
  345. , [Slogs_UserName] nvarchar(20) NOT NULL
  346. , [Slogs_IP] nvarchar(100) NOT NULL
  347. , [Slogs_CreateDatetime] datetime NOT NULL
  348. )
  349. GO
  350. ALTER TABLE [dbo].[tb_ErpSystemLogs] ADD CONSTRAINT [tb_ErpSystemLogs_PK] PRIMARY KEY CLUSTERED (
  351. [ID]
  352. )
  353. GO
  354. GO
  355. IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[tb_ErpInventoryRecords]') AND type in (N'U'))
  356. DROP TABLE [dbo].[tb_ErpInventoryRecords]
  357. GO
  358. CREATE TABLE [dbo].[tb_ErpInventoryRecords] (
  359. [ID] int identity NOT NULL
  360. , [Ir_Type] nvarchar(20) NOT NULL
  361. , [Ir_ProductID] nvarchar(20) NOT NULL
  362. , [Ir_Number] nvarchar(50) NOT NULL
  363. , [Ir_ProductCategory] nvarchar(200) NOT NULL
  364. , [Ir_ProductName] nvarchar(200) NOT NULL
  365. , [Ir_Quantity] int NOT NULL
  366. , [Ir_PersonHandling] nvarchar(20) NOT NULL
  367. , [Ir_Remark] nvarchar(800) NULL
  368. , [Ir_CreateDatetime] datetime NULL
  369. )
  370. GO
  371. ALTER TABLE [dbo].[tb_ErpInventoryRecords] ADD CONSTRAINT [tb_ErpInventoryRecords_PK] PRIMARY KEY CLUSTERED (
  372. [ID]
  373. )
  374. GO
  375. GO
  376. IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[tb_ErpOrder]') AND type in (N'U'))
  377. DROP TABLE [dbo].[tb_ErpOrder]
  378. GO
  379. CREATE TABLE [dbo].[tb_ErpOrder] (
  380. [ID] int identity NOT NULL
  381. , [Ord_Number] nvarchar(20) NOT NULL
  382. , [Ord_Name1] nvarchar(20) NOT NULL
  383. , [Ord_Name2] nvarchar(20) NOT NULL
  384. , [Ord_PhotographyCategory] nvarchar(20) NULL
  385. , [Ord_CustomerSource] nvarchar(20) NULL
  386. , [Ord_PhotographyStatus] nvarchar(20) NOT NULL
  387. , [Ord_EarlyRepairStatus] nvarchar(10) NOT NULL
  388. , [Ord_FilmSelectionStatus] nvarchar(10) NOT NULL
  389. , [Ord_RefinementStatus] nvarchar(10) NOT NULL
  390. , [Ord_DesignStatus] nvarchar(10) NOT NULL
  391. , [Ord_LookDesignStatus] nvarchar(10) NOT NULL
  392. , [Ord_TakePiecesStatus] nvarchar(10) NOT NULL
  393. , [Ord_AppointmentTime] datetime NOT NULL
  394. , [Ord_PhotographyTime] datetime NOT NULL
  395. , [Ord_EarlyRepairTime] datetime NOT NULL
  396. , [Ord_RefinementTime] datetime NOT NULL
  397. , [Ord_LookDesignTime] datetime NOT NULL
  398. , [Ord_FilmSelectionTime] datetime NOT NULL
  399. , [Ord_TakePiecesTime] datetime NOT NULL
  400. , [Ord_OrdersPerson] nvarchar(20) NOT NULL
  401. , [Ord_SeriesName] nvarchar(30) NOT NULL
  402. , [Ord_SeriesPrice] decimal(10,2) NOT NULL
  403. , [Ord_PhotographerNmae] nvarchar(20) NOT NULL
  404. , [Ord_MakeupArtistName] nvarchar(20) NOT NULL
  405. , [Ord_EarlyRepairName] nvarchar(20) NOT NULL
  406. , [Ord_FilmSelectionName] nvarchar(20) NOT NULL
  407. , [Ord_RefinementName] nvarchar(20) NOT NULL
  408. , [Ord_DesignerName] nvarchar(20) NOT NULL
  409. , [Ord_LookDesignName] nvarchar(20) NOT NULL
  410. , [Ord_EntryClerkName] nvarchar(20) NOT NULL
  411. , [Ord_Discount] decimal(10,2) NOT NULL
  412. , [Ord_Authorize] nvarchar(20) NOT NULL
  413. , [Ord_AfterDiscount] decimal(10,2) NOT NULL
  414. , [Ord_AfterAuthorize] decimal(10,2) NOT NULL
  415. , [Ord_GentlemenPhone] nvarchar(20) NOT NULL
  416. , [Ord_LadiesPhone] nvarchar(20) NOT NULL
  417. , [Ord_UserAccount] nvarchar(20) NOT NULL
  418. , [Ord_CustomerID] nvarchar(20) NOT NULL
  419. , [Ord_Price] decimal(10,2) NULL
  420. , [Ord_Remark] nvarchar(800) NULL
  421. , [Ord_CreateDatetime] datetime NOT NULL
  422. , [Ord_UpdateDatetime] datetime NOT NULL
  423. , [Ord_PhotoPath] nvarchar(800) NULL
  424. , [Ord_ClothingQuantity] int NOT NULL
  425. , [Ord_Styling] nvarchar(100) NOT NULL
  426. , [Ord_OnLocation] int NOT NULL
  427. , [Ord_InteriorView] int NOT NULL
  428. , [Ord_Mc_Number] nvarchar(50) NOT NULL
  429. , [Ord_DesignTime] datetime NOT NULL
  430. , [Ord_PhotographerAssistant] nvarchar(20) NOT NULL
  431. , [Ord_MakeupArtistAssistant] nvarchar(20) NOT NULL
  432. )
  433. GO
  434. ALTER TABLE [dbo].[tb_ErpOrder] ADD CONSTRAINT [tb_ErpOrder_PK] PRIMARY KEY CLUSTERED (
  435. [Ord_Number]
  436. )
  437. GO
  438. GO
  439. IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[tb_ErpDepartment]') AND type in (N'U'))
  440. DROP TABLE [dbo].[tb_ErpDepartment]
  441. GO
  442. CREATE TABLE [dbo].[tb_ErpDepartment] (
  443. [ID] int identity NOT NULL
  444. , [Dt_Name] nvarchar(200) NOT NULL
  445. , [Dt_ChargeMan] nvarchar(20) NULL
  446. , [Dt_Telephone] nvarchar(50) NULL
  447. , [Dt_Fax] nvarchar(50) NULL
  448. , [Dt_Remark] nvarchar(800) NULL
  449. , [Dt_CreateDatetime] datetime NULL
  450. , [Dt_UpdateDatetime] datetime NULL
  451. )
  452. GO
  453. ALTER TABLE [dbo].[tb_ErpDepartment] ADD CONSTRAINT [tb_ErpDepartment_PK] PRIMARY KEY CLUSTERED (
  454. [ID]
  455. )
  456. GO
  457. GO
  458. IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[tb_ErpRentalSaleRecords]') AND type in (N'U'))
  459. DROP TABLE [dbo].[tb_ErpRentalSaleRecords]
  460. GO
  461. CREATE TABLE [dbo].[tb_ErpRentalSaleRecords] (
  462. [ID] int identity NOT NULL
  463. , [Rrlist_RsoNumber] nvarchar(50) NOT NULL
  464. , [Rrlist_ProductName] nvarchar(100) NULL
  465. , [Rrlist_ProductNumber] nvarchar(50) NULL
  466. , [Rrlist_ProductQuantity] int NULL
  467. , [Rrlist_ProductThumbnail] nvarchar(800) NULL
  468. , [Rrlist_Status] nvarchar(20) NULL
  469. , [Rrlist_EstimateTakeDate] datetime NULL
  470. , [Rrlist_EstimateReturnDate] datetime NULL
  471. , [Rrlist_ActualTakeDate] datetime NULL
  472. , [Rrlist_ActualReturnDate] datetime NULL
  473. , [Rrlist_RentalSaleRemark] nvarchar(800) NULL
  474. , [Rrlist_Money] decimal(10,2) NULL
  475. , [Rrlist_Deposit] decimal(10,2) NULL
  476. , [Rrlist_ProductBuyPrice] decimal(10,2) NULL
  477. , [Rrlist_ExpiredDays] int NULL
  478. , [Rrlist_ExtendedPayment] decimal(10,2) NULL
  479. , [Rrlist_ReturnRemark] nvarchar(800) NULL
  480. , [Rso_HandlingPerson] nvarchar(20) NOT NULL
  481. , [Rrlist_Type] nvarchar(20) NOT NULL
  482. , [Rrlist_CreateDatetime] datetime NULL
  483. )
  484. GO
  485. ALTER TABLE [dbo].[tb_ErpRentalSaleRecords] ADD CONSTRAINT [tb_ErpRentalSaleRecords_PK] PRIMARY KEY CLUSTERED (
  486. [ID]
  487. )
  488. GO
  489. GO
  490. IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[tb_ErpSmsAccountInfo]') AND type in (N'U'))
  491. DROP TABLE [dbo].[tb_ErpSmsAccountInfo]
  492. GO
  493. CREATE TABLE [dbo].[tb_ErpSmsAccountInfo] (
  494. [ID] int NOT NULL
  495. , [Smsa_AccountNumber] nvarchar(20) NOT NULL
  496. , [Smsa_AccountName] nvarchar(20) NOT NULL
  497. , [Smsa_Password] nvarchar(100) NOT NULL
  498. , [Smsa_MoneyBalances] decimal(10,2) NOT NULL
  499. , [Smsa_SendTypes] nvarchar(100) NOT NULL
  500. , [Smsa_CrealeDatetime] datetime NOT NULL
  501. )
  502. GO
  503. ALTER TABLE [dbo].[tb_ErpSmsAccountInfo] ADD CONSTRAINT [tb_ErpSmsAccountInfo_PK] PRIMARY KEY CLUSTERED (
  504. [ID]
  505. )
  506. GO
  507. GO
  508. IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[tb_ErpRegion]') AND type in (N'U'))
  509. DROP TABLE [dbo].[tb_ErpRegion]
  510. GO
  511. CREATE TABLE [dbo].[tb_ErpRegion] (
  512. [ID] int NOT NULL
  513. , [Region_code] nvarchar(100) NOT NULL
  514. , [Region_name] nvarchar(100) NOT NULL
  515. , [Region_ParentID] nvarchar(100) NOT NULL
  516. , [Region_level] int NULL
  517. , [Region_order] int NULL
  518. , [Region_name_en] nvarchar(100) NULL
  519. , [Region_shortname_en] nvarchar(10) NULL
  520. )
  521. GO
  522. ALTER TABLE [dbo].[tb_ErpRegion] ADD CONSTRAINT [tb_ErpRegion_PK] PRIMARY KEY CLUSTERED (
  523. [ID]
  524. )
  525. GO
  526. GO
  527. IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[tb_ErpCallWizard]') AND type in (N'U'))
  528. DROP TABLE [dbo].[tb_ErpCallWizard]
  529. GO
  530. CREATE TABLE [dbo].[tb_ErpCallWizard] (
  531. [ID] int identity NOT NULL
  532. , [Callw_Telephone] nvarchar(20) NOT NULL
  533. , [Callw_DateTime] datetime NOT NULL
  534. , [Callw_Status] nvarchar(50) NULL
  535. , [Callw_Remark] nvarchar(800) NULL
  536. , [Callw_SoundRecording] nvarchar(1000) NULL
  537. , [Callw_UpdateDatetime] datetime NULL
  538. )
  539. GO
  540. ALTER TABLE [dbo].[tb_ErpCallWizard] ADD CONSTRAINT [tb_ErpCallWizard_PK] PRIMARY KEY CLUSTERED (
  541. [ID]
  542. )
  543. GO
  544. GO
  545. IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[tb_ErpCustomer]') AND type in (N'U'))
  546. DROP TABLE [dbo].[tb_ErpCustomer]
  547. GO
  548. CREATE TABLE [dbo].[tb_ErpCustomer] (
  549. [ID] int identity NOT NULL
  550. , [Cus_Type] nvarchar(20) NOT NULL
  551. , [Cus_Name1] nvarchar(20) NOT NULL
  552. , [Cus_Name2] nvarchar(20) NOT NULL
  553. , [Cus_Telephone1] nvarchar(20) NULL
  554. , [Cus_Telephone2] nvarchar(20) NULL
  555. , [Cus_FixedPhone] nvarchar(20) NULL
  556. , [Cus_QQ1] nvarchar(20) NULL
  557. , [Cus_QQ2] nvarchar(20) NULL
  558. , [Cus_Sex1] int NULL
  559. , [Cus_Sex2] int NULL
  560. , [Cus_Birthday1] nvarchar(20) NULL
  561. , [Cus_Birthday2] nvarchar(20) NULL
  562. , [Cus_Region1] nvarchar(100) NULL
  563. , [Cus_Region2] nvarchar(100) NULL
  564. , [Cus_Address1] nvarchar(100) NULL
  565. , [Cus_Address2] nvarchar(100) NULL
  566. , [Cus_WorkUnit1] nvarchar(100) NULL
  567. , [Cus_WorkUnit2] nvarchar(100) NULL
  568. , [Cus_DayForMarriage] nvarchar(20) NULL
  569. , [Cus_OrderDate] datetime NULL
  570. , [Cus_PackagesName] nvarchar(100) NULL
  571. , [Cus_PackagesMoney] decimal(10,2) NULL
  572. , [Cus_EntryClerk] nvarchar(100) NULL
  573. , [Cus_CustomerSource] nvarchar(100) NULL
  574. , [Cus_Status] nvarchar(20) NULL
  575. , [Cus_LossReason] nvarchar(100) NULL
  576. , [Cus_Remark] char(10) NULL
  577. , [Cus_OrderRecord ] nvarchar(500) NULL
  578. , [Cus_ServiceType] nvarchar(10) NOT NULL
  579. , [Cus_IdentityCardID1] nvarchar(30) NULL
  580. , [Cus_IdentityCardID2] nvarchar(30) NULL
  581. , [Cus_CreateDatetime] datetime NULL
  582. , [Cus_UpdateDatetime] datetime NULL
  583. , [Cus_Lunar1] bit NULL
  584. , [Cus_Lunar2] bit NULL
  585. , [Cus_LovedStyle] nvarchar(500) NULL
  586. )
  587. GO
  588. ALTER TABLE [dbo].[tb_ErpCustomer] ADD CONSTRAINT [tb_ErpCustomer_PK] PRIMARY KEY CLUSTERED (
  589. [ID]
  590. )
  591. GO
  592. GO
  593. IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[tb_ErpCommissionConfigure]') AND type in (N'U'))
  594. DROP TABLE [dbo].[tb_ErpCommissionConfigure]
  595. GO
  596. CREATE TABLE [dbo].[tb_ErpCommissionConfigure] (
  597. [ID] int identity NOT NULL
  598. , [Cconfig_Type] nvarchar(20) NOT NULL
  599. , [Cconfig_OrderNumber] nvarchar(100) NOT NULL
  600. , [Cconfig_Photographer1] nvarchar(20) NOT NULL
  601. , [Cconfig_PhotographerProportion1] decimal(10,2) NOT NULL
  602. , [Cconfig_Photographer2] nvarchar(20) NULL
  603. , [Cconfig_PhotographerProportion2] decimal(10,2) NULL
  604. , [Cconfig_Photographer3] nvarchar(20) NULL
  605. , [Cconfig_PhotographerProportion3] decimal(10,2) NULL
  606. , [Cconfig_Photographer4] nvarchar(20) NULL
  607. , [Cconfig_PhotographerProportion4] decimal(10,2) NULL
  608. , [Cconfig_MakeupArtist1] nvarchar(20) NOT NULL
  609. , [Cconfig_MakeupArtistProportion1] decimal(10,2) NOT NULL
  610. , [Cconfig_MakeupArtist2] nvarchar(20) NULL
  611. , [Cconfig_MakeupArtistProportion2] decimal(10,2) NULL
  612. , [Cconfig_MakeupArtist3] nvarchar(20) NULL
  613. , [Cconfig_MakeupArtistProportion3] decimal(10,2) NULL
  614. , [Cconfig_MakeupArtist4] nvarchar(20) NULL
  615. , [Cconfig_MakeupArtistProportion4] decimal(10,2) NULL
  616. , [Cconfig_MainStore] nvarchar(20) NULL
  617. , [Cconfig_MainStoreProportion] decimal(10,2) NOT NULL
  618. , [Cconfig_ViceStore] nvarchar(20) NOT NULL
  619. , [Cconfig_ViceProportion] decimal(10,2) NULL
  620. , [Cconfig_CreateDatetime] datetime NOT NULL
  621. , [Cconfig_UpdateDatetime] datetime NOT NULL
  622. )
  623. GO
  624. ALTER TABLE [dbo].[tb_ErpCommissionConfigure] ADD CONSTRAINT [tb_ErpCommissionConfigure_PK] PRIMARY KEY CLUSTERED (
  625. [ID]
  626. )
  627. GO
  628. GO
  629. IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[tb_ErpPackages]') AND type in (N'U'))
  630. DROP TABLE [dbo].[tb_ErpPackages]
  631. GO
  632. CREATE TABLE [dbo].[tb_ErpPackages] (
  633. [ID] int identity NOT NULL
  634. , [Pak_PackagesID] nvarchar(20) NOT NULL
  635. , [Pak_PackagesClass] nvarchar(10) NOT NULL
  636. , [Pak_Name] nvarchar(200) NOT NULL
  637. , [Pak_UnitPrice] decimal(10,2) NOT NULL
  638. , [Pak_IsDisable] bit NOT NULL
  639. , [Pak_Remark] nvarchar(200) NULL
  640. , [Pak_IntoTheArchive] int NOT NULL
  641. , [Pak_IntoTheBook] int NOT NULL
  642. , [Pak_CreateDatetime] datetime NOT NULL
  643. , [Pak_UpdateDatetime] datetime NOT NULL
  644. )
  645. GO
  646. ALTER TABLE [dbo].[tb_ErpPackages] ADD CONSTRAINT [tb_ErpPackages_PK] PRIMARY KEY CLUSTERED (
  647. [Pak_PackagesID]
  648. )
  649. GO
  650. GO
  651. IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[tb_ErpFormalDress]') AND type in (N'U'))
  652. DROP TABLE [dbo].[tb_ErpFormalDress]
  653. GO
  654. CREATE TABLE [dbo].[tb_ErpFormalDress] (
  655. [ID] int identity NOT NULL
  656. , [Fd_Number] nvarchar(20) NOT NULL
  657. , [Fd_Type] nvarchar(100) NOT NULL
  658. , [Fd_Category] nvarchar(100) NOT NULL
  659. , [Fd_PlacedArea] nvarchar(50) NULL
  660. , [Fd_Name] nvarchar(100) NULL
  661. , [Fd_Quantity] int NULL
  662. , [Fd_RentalPrice] decimal(10,2) NULL
  663. , [Fd_SalePrice] decimal(10,2) NULL
  664. , [Fd_BuyPrice] decimal(10,2) NULL
  665. , [Fd_BuyDatetime] datetime NULL
  666. , [Fd_Introduction] nvarchar(800) NULL
  667. , [Fd_Detail] text NULL
  668. , [Fd_MainPhoto ] nvarchar(200) NULL
  669. , [Fd_Thumbnail] nvarchar(800) NULL
  670. , [Fd_PhotoAlbum] nvarchar(800) NULL
  671. , [Fd_Remark] nvarchar(800) NULL
  672. , [Fd_StarRating] int NULL
  673. , [Fd_IsEnabled] bit NOT NULL
  674. , [Fd_IsShows] bit NOT NULL
  675. , [Fd_Status] nvarchar(100) NOT NULL
  676. , [Fd_AreLeasedQuantity] int NOT NULL
  677. , [Fd_HasSoldQuantity] int NOT NULL
  678. , [Fd_TheLaundryQuantity] int NOT NULL
  679. , [Fd_CreateDatetime] datetime NOT NULL
  680. , [Fd_UpdateDatetime] datetime NOT NULL
  681. )
  682. GO
  683. ALTER TABLE [dbo].[tb_ErpFormalDress] ADD CONSTRAINT [tb_ErpFormalDress_PK] PRIMARY KEY CLUSTERED (
  684. [Fd_Number]
  685. )
  686. GO
  687. GO
  688. IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[tb_ErpSMSTemplates]') AND type in (N'U'))
  689. DROP TABLE [dbo].[tb_ErpSMSTemplates]
  690. GO
  691. CREATE TABLE [dbo].[tb_ErpSMSTemplates] (
  692. [ID] int identity NOT NULL
  693. , [Smst_Type] nvarchar(20) NULL
  694. , [Smst_Category] nvarchar(100) NULL
  695. , [Smst_Title] nvarchar(500) NULL
  696. , [Smst_Content] nvarchar(4000) NULL
  697. , [Smst_IsReadOnly] bit NULL
  698. , [Smst_SendCondition] nvarchar(500) NULL
  699. , [Smst_CreateDatetime] datetime NULL
  700. , [Smst_UpdateDatetime] datetime NULL
  701. )
  702. GO
  703. ALTER TABLE [dbo].[tb_ErpSMSTemplates] ADD CONSTRAINT [tb_ErpSMSTemplates_PK] PRIMARY KEY CLUSTERED (
  704. [ID]
  705. )
  706. GO
  707. GO
  708. IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[tb_ErpSystemCategory]') AND type in (N'U'))
  709. DROP TABLE [dbo].[tb_ErpSystemCategory]
  710. GO
  711. CREATE TABLE [dbo].[tb_ErpSystemCategory] (
  712. [ID] int identity NOT NULL
  713. , [Sc_ClassCode] nvarchar(10) NOT NULL
  714. , [Sc_ClassName] nvarchar(100) NOT NULL
  715. , [Sc_ClassParentID] int NOT NULL
  716. , [Sc_ClassRemark] nvarchar(500) NOT NULL
  717. , [Sc_IsDisable] bit NOT NULL
  718. , [Sc_IsReadOnly] bit NOT NULL
  719. , [Sc_URL] nvarchar(50) NULL
  720. , [Sc_IsEnabledURL] bit NULL
  721. , [Sc_CreateDatetime] datetime NOT NULL
  722. , [Sc_UpdateDatetime] datetime NOT NULL
  723. )
  724. GO
  725. ALTER TABLE [dbo].[tb_ErpSystemCategory] ADD CONSTRAINT [tb_ErpSystemCategory_PK] PRIMARY KEY CLUSTERED (
  726. [ID]
  727. )
  728. GO
  729. GO
  730. IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[tb_ErpSystemInfo]') AND type in (N'U'))
  731. DROP TABLE [dbo].[tb_ErpSystemInfo]
  732. GO
  733. CREATE TABLE [dbo].[tb_ErpSystemInfo] (
  734. [ID] int identity NOT NULL
  735. , [SysInfo_SysName] nvarchar(100) NULL
  736. , [SysInfo_Version] nvarchar(50) NULL
  737. , [SysInfo_Description] nvarchar(800) NULL
  738. , [SysInfo_CompanyName] nvarchar(100) NULL
  739. , [SysInfo_Telephone] nvarchar(200) NULL
  740. , [SysInfo_Fax] nvarchar(50) NULL
  741. , [SysInfo_Email] nvarchar(100) NULL
  742. , [SysInfo_Address] nvarchar(200) NULL
  743. , [SysInfo_URL] nvarchar(200) NULL
  744. , [SysInfo_Agreement] nvarchar(800) NULL
  745. , [SysInfo_CopyrightNotice] nvarchar(800) NULL
  746. , [SysInfo_ServiceDescription] nvarchar(800) NULL
  747. )
  748. GO
  749. ALTER TABLE [dbo].[tb_ErpSystemInfo] ADD CONSTRAINT [tb_ErpSystemInfo_PK] PRIMARY KEY CLUSTERED (
  750. [ID]
  751. )
  752. GO
  753. GO
  754. IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[tb_ErpSMSRecord]') AND type in (N'U'))
  755. DROP TABLE [dbo].[tb_ErpSMSRecord]
  756. GO
  757. CREATE TABLE [dbo].[tb_ErpSMSRecord] (
  758. [ID] int identity NOT NULL
  759. , [Smsr_RecipientNumber] nvarchar(4000) NOT NULL
  760. , [Smsr_Content] nvarchar(500) NOT NULL
  761. , [Smsr_SendCreateDatetime] datetime NOT NULL
  762. , [Smsr_SendExpense] decimal(10,2) NULL
  763. , [Smsr_Status] nvarchar(200) NULL
  764. , [Smsr_SendPeople] nvarchar(20) NULL
  765. , [Smsr_SendSumCount] int NULL
  766. , [Smsr_SendSuccess] int NULL
  767. , [Smsr_FailureTelephone] nvarchar(4000) NULL
  768. , [Smsr_SendRemark] nvarchar(800) NULL
  769. , [Smsr_CreateDatetime] datetime NULL
  770. )
  771. GO
  772. ALTER TABLE [dbo].[tb_ErpSMSRecord] ADD CONSTRAINT [tb_ErpSMSRecord_PK] PRIMARY KEY CLUSTERED (
  773. [ID]
  774. )
  775. GO
  776. GO
  777. IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[tb_ErpRewardPunishment]') AND type in (N'U'))
  778. DROP TABLE [dbo].[tb_ErpRewardPunishment]
  779. GO
  780. CREATE TABLE [dbo].[tb_ErpRewardPunishment] (
  781. [ID] int identity NOT NULL
  782. , [Rp_Type] nvarchar(20) NOT NULL
  783. , [Rp_RelevantPeople] nvarchar(20) NOT NULL
  784. , [Rp_Money] decimal(10,2) NOT NULL
  785. , [Rp_Status] nvarchar(20) NULL
  786. , [Rp_RPDatetime] datetime NULL
  787. , [Rp_PersonHandling] nvarchar(20) NOT NULL
  788. , [Rp_Reason] nvarchar(800) NOT NULL
  789. , [Rp_Remark] nvarchar(800) NULL
  790. , [Rp_CreateDatetime] datetime NOT NULL
  791. , [Rp_UpdateDatetime] datetime NOT NULL
  792. )
  793. GO
  794. ALTER TABLE [dbo].[tb_ErpRewardPunishment] ADD CONSTRAINT [tb_ErpRewardPunishment_PK] PRIMARY KEY CLUSTERED (
  795. [ID]
  796. )
  797. GO
  798. GO
  799. IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[tb_ErpUserExpandInfo]') AND type in (N'U'))
  800. DROP TABLE [dbo].[tb_ErpUserExpandInfo]
  801. GO
  802. CREATE TABLE [dbo].[tb_ErpUserExpandInfo] (
  803. [ID] int identity NOT NULL
  804. , [Uei_UserAccount] nvarchar(20) NOT NULL
  805. , [Uei_EfFieldCode] nvarchar(10) NOT NULL
  806. , [Uei_ExpandValue] nvarchar(1000) NOT NULL
  807. , [Uei_CreateDatetime] datetime NOT NULL
  808. , [Uei_UpdateDatetime] datetime NOT NULL
  809. )
  810. GO
  811. ALTER TABLE [dbo].[tb_ErpUserExpandInfo] ADD CONSTRAINT [tb_ErpUserExpandInfo_PK] PRIMARY KEY CLUSTERED (
  812. [ID]
  813. )
  814. GO
  815. GO
  816. IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[tb_ErpUseRecord]') AND type in (N'U'))
  817. DROP TABLE [dbo].[tb_ErpUseRecord]
  818. GO
  819. CREATE TABLE [dbo].[tb_ErpUseRecord] (
  820. [ID] int identity NOT NULL
  821. , [Ur_McNumber] nvarchar(50) NOT NULL
  822. , [Ur_ParentNumber] nvarchar(50) NOT NULL
  823. , [Ur_Type] nvarchar(20) NOT NULL
  824. , [Ur_OrderNumber] nvarchar(50) NULL
  825. , [Ur_Points] int NOT NULL
  826. , [Ur_Money] decimal(10,2) NULL
  827. , [Ur_Title] nvarchar(100) NOT NULL
  828. , [Ur_Remark] nvarchar(800) NULL
  829. , [Ur_CreateDatetime] datetime NOT NULL
  830. )
  831. GO
  832. ALTER TABLE [dbo].[tb_ErpUseRecord] ADD CONSTRAINT [tb_ErpUseRecord_PK] PRIMARY KEY CLUSTERED (
  833. [ID]
  834. )
  835. GO
  836. GO
  837. IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[tb_ErpOtherIncomeAndExpenses]') AND type in (N'U'))
  838. DROP TABLE [dbo].[tb_ErpOtherIncomeAndExpenses]
  839. GO
  840. CREATE TABLE [dbo].[tb_ErpOtherIncomeAndExpenses] (
  841. [ID] int identity NOT NULL
  842. , [Oiae_Type] nvarchar(20) NULL
  843. , [Oiae_ProjectName] nvarchar(200) NOT NULL
  844. , [Oiae_Money] decimal(10,2) NOT NULL
  845. , [Oiae_IEDatetime] datetime NOT NULL
  846. , [Oiae_PersonHandling] nvarchar(20) NOT NULL
  847. , [Oiae_ThePayer] nvarchar(20) NOT NULL
  848. , [Oiae_Invoice] nvarchar(500) NULL
  849. , [Oiae_Remark] nvarchar(800) NULL
  850. , [Oiae_CreateDatetime] datetime NOT NULL
  851. )
  852. GO
  853. ALTER TABLE [dbo].[tb_ErpOtherIncomeAndExpenses] ADD CONSTRAINT [tb_ErpOtherIncomeAndExpenses_PK] PRIMARY KEY CLUSTERED (
  854. [ID]
  855. )
  856. GO
  857. GO
  858. IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[tb_ErpCompanyInfo]') AND type in (N'U'))
  859. DROP TABLE [dbo].[tb_ErpCompanyInfo]
  860. GO
  861. CREATE TABLE [dbo].[tb_ErpCompanyInfo] (
  862. [ID] int identity NOT NULL
  863. , [Company_Name] nvarchar(100) NOT NULL
  864. , [Company_Manager] nvarchar(20) NULL
  865. , [Company_Telephone ] nvarchar(100) NULL
  866. , [Company_Fax] nvarchar(20) NULL
  867. , [Company_URL] nvarchar(100) NULL
  868. , [Company_Address] nvarchar(100) NULL
  869. , [Company_SingleTitle] nvarchar(200) NULL
  870. , [Company_SingleExplanation] nvarchar(200) NULL
  871. , [Company_ReservationExplanation] nvarchar(800) NULL
  872. , [Company_ProductionNotes] nvarchar(800) NULL
  873. , [Company_DressDescription] nvarchar(800) NULL
  874. , [Company_DimensionalCode] nvarchar(200) NULL
  875. , [Company_About] nvarchar(800) NULL
  876. , [Company_PhotoThumbnail] nvarchar(800) NULL
  877. , [Company_PhotoAlbum] nvarchar(800) NULL
  878. , [Company_Detail] text NULL
  879. , [Company_CreateDatetime] datetime NOT NULL
  880. , [Company_UpdateDatetime] datetime NOT NULL
  881. )
  882. GO
  883. ALTER TABLE [dbo].[tb_ErpCompanyInfo] ADD CONSTRAINT [tb_ErpCompanyInfo_PK] PRIMARY KEY CLUSTERED (
  884. [ID]
  885. )
  886. GO
  887. GO
  888. IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[tb_ErpContactRecord]') AND type in (N'U'))
  889. DROP TABLE [dbo].[tb_ErpContactRecord]
  890. GO
  891. CREATE TABLE [dbo].[tb_ErpContactRecord] (
  892. [ID] int identity NOT NULL
  893. , [Cr_CustomerID] nvarchar(20) NOT NULL
  894. , [Cr_ContactName] nvarchar(20) NOT NULL
  895. , [Cr_Topic] nvarchar(100) NOT NULL
  896. , [Cr_Content] nvarchar(800) NOT NULL
  897. , [Cr_CustomerResponse] nvarchar(800) NULL
  898. , [Cr_Remark] nvarchar(800) NULL
  899. , [Cr_ReturnVisitTime] datetime NULL
  900. , [Cr_IsRemind] bit NULL
  901. , [Cr_ContactDatetime] datetime NULL
  902. , [Cr_CreateDatetime] datetime NULL
  903. )
  904. GO
  905. ALTER TABLE [dbo].[tb_ErpContactRecord] ADD CONSTRAINT [tb_ErpContactRecord_PK] PRIMARY KEY CLUSTERED (
  906. [ID]
  907. )
  908. GO
  909. GO
  910. IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[tb_ErpClientSatisfaction]') AND type in (N'U'))
  911. DROP TABLE [dbo].[tb_ErpClientSatisfaction]
  912. GO
  913. CREATE TABLE [dbo].[tb_ErpClientSatisfaction] (
  914. [ID] int identity NOT NULL
  915. , [Csf_OrdersNumber] nvarchar(20) NOT NULL
  916. , [Csf_Reception] int NULL
  917. , [Csf_Makeup] int NULL
  918. , [Csf_Photography] int NULL
  919. , [Csf_Digital] int NULL
  920. , [Csf_FilmSelection] int NULL
  921. , [Csf_Progress] int NULL
  922. , [Csf_Product] int NULL
  923. , [Csf_Remark] nvarchar(800) NULL
  924. , [Csf_CreateDatetime] datetime NULL
  925. )
  926. GO
  927. ALTER TABLE [dbo].[tb_ErpClientSatisfaction] ADD CONSTRAINT [tb_ErpClientSatisfaction_PK] PRIMARY KEY CLUSTERED (
  928. [ID]
  929. )
  930. GO
  931. GO
  932. IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[tb_ErpPermissionTemplate]') AND type in (N'U'))
  933. DROP TABLE [dbo].[tb_ErpPermissionTemplate]
  934. GO
  935. CREATE TABLE [dbo].[tb_ErpPermissionTemplate] (
  936. [ID] int identity NOT NULL
  937. , [Pte_TemplateName] nvarchar(20) NOT NULL
  938. , [Pte_PermissionValue] nvarchar(200) NOT NULL
  939. , [Pte_CreateDatetime] datetime NOT NULL
  940. , [Pte_UpdateDatetime] datetime NOT NULL
  941. )
  942. GO
  943. ALTER TABLE [dbo].[tb_ErpPermissionTemplate] ADD CONSTRAINT [tb_ErpPermissionTemplate_PK] PRIMARY KEY CLUSTERED (
  944. [ID]
  945. )
  946. GO
  947. GO
  948. IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[tb_ErpExpandField]') AND type in (N'U'))
  949. DROP TABLE [dbo].[tb_ErpExpandField]
  950. GO
  951. CREATE TABLE [dbo].[tb_ErpExpandField] (
  952. [ID] int identity NOT NULL
  953. , [Ef_FieldCode] nvarchar(10) NOT NULL
  954. , [Ef_FieldName] nvarchar(20) NOT NULL
  955. , [Ef_FieldValueList] nvarchar(1000) NOT NULL
  956. , [Ef_DefaultValue] nvarchar(200) NOT NULL
  957. , [Ef_FieldType] nvarchar(10) NOT NULL
  958. , [Ef_CreateDatetime] datetime NOT NULL
  959. , [Ef_UpdateDatetime] datetime NOT NULL
  960. , [Ef_FieldRemark] nvarchar(100) NOT NULL
  961. )
  962. GO
  963. ALTER TABLE [dbo].[tb_ErpExpandField] ADD CONSTRAINT [tb_ErpExpandField_PK] PRIMARY KEY CLUSTERED (
  964. [Ef_FieldCode]
  965. )
  966. GO
  967. GO
  968. IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[tb_ErpTwoSalesOrder]') AND type in (N'U'))
  969. DROP TABLE [dbo].[tb_ErpTwoSalesOrder]
  970. GO
  971. CREATE TABLE [dbo].[tb_ErpTwoSalesOrder] (
  972. [ID] int identity NOT NULL
  973. , [Tsorder_Number] nvarchar(50) NOT NULL
  974. , [Tsorder_Name] nvarchar(200) NOT NULL
  975. , [Tsorder_CustomerName] nvarchar(200) NOT NULL
  976. , [Tsorder_Telephone] nvarchar(20) NOT NULL
  977. , [Tsorder_Money] decimal(10,2) NOT NULL
  978. , [Tsorder_Quantity] int NOT NULL
  979. , [Tsorder_Category] nvarchar(200) NOT NULL
  980. , [Tsorder_OpenSingle] nvarchar(20) NOT NULL
  981. , [Tsorder_PersonHandling] nvarchar(20) NOT NULL
  982. , [Tsorder_Remark] nvarchar(800) NULL
  983. , [Tsorder_CreateDatetime] datetime NOT NULL
  984. , [Tsorder_UpdateDatetime] datetime NOT NULL
  985. )
  986. GO
  987. ALTER TABLE [dbo].[tb_ErpTwoSalesOrder] ADD CONSTRAINT [tb_ErpTwoSalesOrder_PK] PRIMARY KEY CLUSTERED (
  988. [Tsorder_Number]
  989. )
  990. GO
  991. GO
  992. IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[tb_ErpSystemConfigure]') AND type in (N'U'))
  993. DROP TABLE [dbo].[tb_ErpSystemConfigure]
  994. GO
  995. CREATE TABLE [dbo].[tb_ErpSystemConfigure] (
  996. [ID] int identity NOT NULL
  997. , [Sconfig_Code] nvarchar(10) NOT NULL
  998. , [Sconfig_Name] nvarchar(100) NOT NULL
  999. , [Sconfig_Value] nvarchar(500) NOT NULL
  1000. , [Sconfig_IsEnabled] bit NULL
  1001. , [Sconfig_Remark] nvarchar(800) NULL
  1002. , [Sconfig_Type] nvarchar(10) NOT NULL
  1003. , [Sconfig_Order] int NULL
  1004. , [Sconfig_CreateDatetime] datetime NULL
  1005. )
  1006. GO
  1007. ALTER TABLE [dbo].[tb_ErpSystemConfigure] ADD CONSTRAINT [tb_ErpSystemConfigure_PK] PRIMARY KEY CLUSTERED (
  1008. [Sconfig_Code]
  1009. )
  1010. GO
  1011. GO
  1012. IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[tb_ErpConfigureInfo]') AND type in (N'U'))
  1013. DROP TABLE [dbo].[tb_ErpConfigureInfo]
  1014. GO
  1015. CREATE TABLE [dbo].[tb_ErpConfigureInfo] (
  1016. [ID] int identity NOT NULL
  1017. , [Cfinfo_Code] nvarchar(10) NOT NULL
  1018. , [Cfinfo_Type] nvarchar(10) NOT NULL
  1019. , [Cfinfo_Title] nvarchar(200) NOT NULL
  1020. , [Cfinfo_Text] text NOT NULL
  1021. , [Cfinfo_IsEnabled] bit NOT NULL
  1022. , [Cfinfo_Order] int NULL
  1023. , [Cfinfo_CreateDatetime] datetime NULL
  1024. , [Cfinfo_UpdateDatetime] datetime NULL
  1025. )
  1026. GO
  1027. ALTER TABLE [dbo].[tb_ErpConfigureInfo] ADD CONSTRAINT [tb_ErpConfigureInfo_PK] PRIMARY KEY CLUSTERED (
  1028. [Cfinfo_Code]
  1029. )
  1030. GO
  1031. GO
  1032. IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[tb_ErpRosteringSettings]') AND type in (N'U'))
  1033. DROP TABLE [dbo].[tb_ErpRosteringSettings]
  1034. GO
  1035. CREATE TABLE [dbo].[tb_ErpRosteringSettings] (
  1036. [ID] int identity NOT NULL
  1037. , [Rs_Name] nvarchar(20) NOT NULL
  1038. , [Rs_WorkTime] nvarchar(100) NOT NULL
  1039. , [Rs_OffWorkTime] nvarchar(100) NOT NULL
  1040. , [Rs_CreateDatetime] datetime NOT NULL
  1041. , [Rs_UpdateDatetime] datetime NOT NULL
  1042. )
  1043. GO
  1044. ALTER TABLE [dbo].[tb_ErpRosteringSettings] ADD CONSTRAINT [tb_ErpRosteringSettings_PK] PRIMARY KEY CLUSTERED (
  1045. [ID]
  1046. )
  1047. GO
  1048. GO
  1049. IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[tb_ErpVendor]') AND type in (N'U'))
  1050. DROP TABLE [dbo].[tb_ErpVendor]
  1051. GO
  1052. CREATE TABLE [dbo].[tb_ErpVendor] (
  1053. [ID] int identity NOT NULL
  1054. , [Vd_Number] nvarchar(20) NOT NULL
  1055. , [Vd_Name] nvarchar(100) NOT NULL
  1056. , [Vd_Address] nvarchar(200) NULL
  1057. , [Vd_ContactPerson] nvarchar(20) NULL
  1058. , [Vd_Telephone] nvarchar(100) NULL
  1059. , [Vd_Fax] nvarchar(50) NULL
  1060. , [Vd_URL] nvarchar(200) NULL
  1061. , [Vd_Remark] nvarchar(800) NULL
  1062. )
  1063. GO
  1064. ALTER TABLE [dbo].[tb_ErpVendor] ADD CONSTRAINT [tb_ErpVendor_PK] PRIMARY KEY CLUSTERED (
  1065. [Vd_Number]
  1066. )
  1067. GO
  1068. GO
  1069. IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[tb_ErpStyle]') AND type in (N'U'))
  1070. DROP TABLE [dbo].[tb_ErpStyle]
  1071. GO
  1072. CREATE TABLE [dbo].[tb_ErpStyle] (
  1073. [ID] int identity NOT NULL
  1074. , [Style_Name] nvarchar(20) NOT NULL
  1075. , [Style_Description] nvarchar(800) NULL
  1076. , [Style_PhotoThumbnail] nvarchar(800) NULL
  1077. , [Style_PhotoAlbum] nvarchar(800) NULL
  1078. , [Style_Detail] text NULL
  1079. , [Style_StarRating] int NULL
  1080. , [Style_CreateDatetime] datetime NULL
  1081. , [Style_UpdateDatetime] datetime NULL
  1082. )
  1083. GO
  1084. ALTER TABLE [dbo].[tb_ErpStyle] ADD CONSTRAINT [tb_ErpStyle_PK] PRIMARY KEY CLUSTERED (
  1085. [ID]
  1086. )
  1087. GO
  1088. GO
  1089. IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[tb_ErpRentalSaleOrder]') AND type in (N'U'))
  1090. DROP TABLE [dbo].[tb_ErpRentalSaleOrder]
  1091. GO
  1092. CREATE TABLE [dbo].[tb_ErpRentalSaleOrder] (
  1093. [ID] int identity NOT NULL
  1094. , [Rso_Number] nvarchar(50) NOT NULL
  1095. , [Rso_Type] nvarchar(50) NOT NULL
  1096. , [Rso_RentMoney] decimal(10,2) NOT NULL
  1097. , [Rso_Deposit] decimal(10,2) NOT NULL
  1098. , [Rso_HandlingPerson] nvarchar(20) NOT NULL
  1099. , [Rso_RentalSaleDatetime] datetime NOT NULL
  1100. , [Rso_RentalSaleRemark] nvarchar(800) NULL
  1101. , [Rso_ReturnRemark] nvarchar(800) NULL
  1102. , [Rso_CustomerName] nvarchar(20) NOT NULL
  1103. , [Rso_Telephone] nvarchar(20) NOT NULL
  1104. , [Rso_QQ] nvarchar(20) NULL
  1105. , [Rso_Address] nvarchar(100) NULL
  1106. , [Rso_CompanyName] nvarchar(100) NULL
  1107. , [Rso_WeddingDay] datetime NULL
  1108. , [Rso_Birthday] nvarchar(20) NULL
  1109. , [Rso_EstimateTakeDate] datetime NOT NULL
  1110. , [Rso_EstimateReturnDate] datetime NOT NULL
  1111. , [Rso_ActualTakeDate] datetime NOT NULL
  1112. , [Rso_ActualReturnDate] datetime NOT NULL
  1113. , [Rso_ProductName] nvarchar(100) NOT NULL
  1114. , [Rso_ProductNumber] nvarchar(20) NOT NULL
  1115. , [Rso_ProductQuantity] int NOT NULL
  1116. , [Rso_Status] nvarchar(20) NOT NULL
  1117. , [Rso_CreateDatetime] datetime NOT NULL
  1118. )
  1119. GO
  1120. ALTER TABLE [dbo].[tb_ErpRentalSaleOrder] ADD CONSTRAINT [tb_ErpRentalSaleOrder_PK] PRIMARY KEY CLUSTERED (
  1121. [Rso_Number]
  1122. )
  1123. GO
  1124. SET ANSI_NULLS ON
  1125. GO
  1126. SET QUOTED_IDENTIFIER ON
  1127. GO
  1128. CREATE TABLE [dbo].[tb_ErpPackagesGiftMerchandise](
  1129. [ID] [int] IDENTITY(1,1) NOT NULL,
  1130. [Pgm_GiveType] [int] NULL,
  1131. [Pgm_ProductNumber] [nvarchar](20) NULL,
  1132. [Pgm_Quantity] [int] NULL,
  1133. [Pgm_PackagesNumber] [nvarchar](20) NULL
  1134. CONSTRAINT [PK_tb_ErpPackagesGiftMerchandise] PRIMARY KEY CLUSTERED
  1135. (
  1136. [ID] ASC
  1137. )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
  1138. ) ON [PRIMARY]
  1139. GO
  1140. --GO
  1141. --GO
  1142. --GO
  1143. --GO
  1144. --GO
  1145. --GO
  1146. --GO
  1147. --GO
  1148. --GO
  1149. --GO
  1150. --GO
  1151. --GO
  1152. --GO
  1153. --GO
  1154. --GO
  1155. --GO
  1156. --GO
  1157. --GO
  1158. --GO
  1159. --GO
  1160. --GO
  1161. --GO
  1162. --GO
  1163. --GO
  1164. --GO
  1165. --GO
  1166. --GO
  1167. --GO
  1168. --GO
  1169. --GO
  1170. --GO
  1171. --GO
  1172. --GO
  1173. --GO
  1174. --GO
  1175. --GO
  1176. --GO
  1177. --GO
  1178. --GO
  1179. --GO
  1180. --GO
  1181. --GO
  1182. --GO