20210704085828_Init.cs 37 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658
  1. using System;
  2. using Microsoft.EntityFrameworkCore.Migrations;
  3. namespace WCS.Service.Migrations
  4. {
  5. public partial class Init : Migration
  6. {
  7. protected override void Up(MigrationBuilder migrationBuilder)
  8. {
  9. migrationBuilder.CreateTable(
  10. name: "WCS_CMD",
  11. columns: table => new
  12. {
  13. ID = table.Column<int>(type: "int", nullable: false)
  14. .Annotation("SqlServer:Identity", "1, 1"),
  15. DEVICE_CODE = table.Column<string>(type: "nvarchar(20)", maxLength: 20, nullable: true),
  16. PROTOCOL = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
  17. PROPERTY = table.Column<string>(type: "nvarchar(32)", maxLength: 32, nullable: true),
  18. VALUE = table.Column<string>(type: "nvarchar(512)", maxLength: 512, nullable: true),
  19. WCSVERSION = table.Column<int>(type: "int", nullable: false),
  20. ENABLED = table.Column<bool>(type: "bit", nullable: false),
  21. UPDATEUSER = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
  22. UPDATETIME = table.Column<DateTime>(type: "datetime2", nullable: false),
  23. VER = table.Column<byte[]>(type: "rowversion", rowVersion: true, nullable: true)
  24. },
  25. constraints: table =>
  26. {
  27. table.PrimaryKey("PK_WCS_CMD", x => x.ID);
  28. });
  29. migrationBuilder.CreateTable(
  30. name: "WCS_DEVICE",
  31. columns: table => new
  32. {
  33. CODE = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
  34. NAME = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
  35. TYPE = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false),
  36. ENABLED = table.Column<bool>(type: "bit", nullable: false),
  37. UPDATEUSER = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
  38. UPDATETIME = table.Column<DateTime>(type: "datetime2", nullable: false),
  39. VER = table.Column<byte[]>(type: "rowversion", rowVersion: true, nullable: true)
  40. },
  41. constraints: table =>
  42. {
  43. table.PrimaryKey("PK_WCS_DEVICE", x => x.CODE);
  44. });
  45. migrationBuilder.CreateTable(
  46. name: "WCS_EXCEPTION",
  47. columns: table => new
  48. {
  49. ID = table.Column<int>(type: "int", nullable: false)
  50. .Annotation("SqlServer:Identity", "1, 1"),
  51. MSG = table.Column<string>(type: "nvarchar(1000)", maxLength: 1000, nullable: true),
  52. STARTTIME = table.Column<DateTime>(type: "datetime2", nullable: false),
  53. TIMES = table.Column<int>(type: "int", nullable: false),
  54. ENABLED = table.Column<bool>(type: "bit", nullable: false),
  55. UPDATEUSER = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
  56. UPDATETIME = table.Column<DateTime>(type: "datetime2", nullable: false),
  57. VER = table.Column<byte[]>(type: "rowversion", rowVersion: true, nullable: true)
  58. },
  59. constraints: table =>
  60. {
  61. table.PrimaryKey("PK_WCS_EXCEPTION", x => x.ID);
  62. });
  63. migrationBuilder.CreateTable(
  64. name: "WCS_PLC",
  65. columns: table => new
  66. {
  67. CODE = table.Column<string>(type: "nvarchar(20)", maxLength: 20, nullable: false),
  68. NAME = table.Column<string>(type: "nvarchar(20)", maxLength: 20, nullable: true),
  69. IP = table.Column<string>(type: "nvarchar(20)", maxLength: 20, nullable: true),
  70. PORT = table.Column<int>(type: "int", nullable: false),
  71. SLOT = table.Column<int>(type: "int", nullable: false),
  72. RACK = table.Column<int>(type: "int", nullable: false),
  73. TYPE = table.Column<int>(type: "int", nullable: false),
  74. MODEL = table.Column<string>(type: "nvarchar(10)", maxLength: 10, nullable: true),
  75. ENABLED = table.Column<bool>(type: "bit", nullable: false),
  76. UPDATEUSER = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
  77. UPDATETIME = table.Column<DateTime>(type: "datetime2", nullable: false),
  78. VER = table.Column<byte[]>(type: "rowversion", rowVersion: true, nullable: true)
  79. },
  80. constraints: table =>
  81. {
  82. table.PrimaryKey("PK_WCS_PLC", x => x.CODE);
  83. });
  84. migrationBuilder.CreateTable(
  85. name: "WCS_BCR80",
  86. columns: table => new
  87. {
  88. ID = table.Column<int>(type: "int", nullable: false)
  89. .Annotation("SqlServer:Identity", "1, 1"),
  90. CONTENT = table.Column<string>(type: "nvarchar(20)", maxLength: 20, nullable: true),
  91. ENABLED = table.Column<bool>(type: "bit", nullable: false),
  92. UPDATEUSER = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
  93. UPDATETIME = table.Column<DateTime>(type: "datetime2", nullable: false),
  94. VER = table.Column<byte[]>(type: "rowversion", rowVersion: true, nullable: true),
  95. DEVICECODE = table.Column<string>(type: "nvarchar(50)", nullable: true),
  96. FRAME = table.Column<DateTime>(type: "datetime2", nullable: false),
  97. ISLAST = table.Column<bool>(type: "bit", nullable: false),
  98. WCSVERSION = table.Column<int>(type: "int", nullable: false)
  99. },
  100. constraints: table =>
  101. {
  102. table.PrimaryKey("PK_WCS_BCR80", x => x.ID);
  103. table.ForeignKey(
  104. name: "FK_WCS_BCR80_WCS_DEVICE_DEVICECODE",
  105. column: x => x.DEVICECODE,
  106. principalTable: "WCS_DEVICE",
  107. principalColumn: "CODE",
  108. onDelete: ReferentialAction.Restrict);
  109. });
  110. migrationBuilder.CreateTable(
  111. name: "WCS_RGV520",
  112. columns: table => new
  113. {
  114. ID = table.Column<int>(type: "int", nullable: false)
  115. .Annotation("SqlServer:Identity", "1, 1"),
  116. TaskID_1 = table.Column<int>(type: "int", nullable: false),
  117. TaskType_1 = table.Column<short>(type: "smallint", nullable: false),
  118. StartPosition_1 = table.Column<short>(type: "smallint", nullable: false),
  119. DestPosition_1 = table.Column<short>(type: "smallint", nullable: false),
  120. PRIORITY_1 = table.Column<short>(type: "smallint", nullable: false),
  121. RES1_1 = table.Column<short>(type: "smallint", nullable: false),
  122. RES2_1 = table.Column<short>(type: "smallint", nullable: false),
  123. Trigger_1 = table.Column<short>(type: "smallint", nullable: false),
  124. TaskID_2 = table.Column<int>(type: "int", nullable: false),
  125. TaskType_2 = table.Column<short>(type: "smallint", nullable: false),
  126. StartPosition_2 = table.Column<short>(type: "smallint", nullable: false),
  127. DestPosition_2 = table.Column<short>(type: "smallint", nullable: false),
  128. PRIORITY_2 = table.Column<short>(type: "smallint", nullable: false),
  129. RES1_2 = table.Column<short>(type: "smallint", nullable: false),
  130. RES2_2 = table.Column<short>(type: "smallint", nullable: false),
  131. Trigger_2 = table.Column<short>(type: "smallint", nullable: false),
  132. ENABLED = table.Column<bool>(type: "bit", nullable: false),
  133. UPDATEUSER = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
  134. UPDATETIME = table.Column<DateTime>(type: "datetime2", nullable: false),
  135. VER = table.Column<byte[]>(type: "rowversion", rowVersion: true, nullable: true),
  136. DEVICECODE = table.Column<string>(type: "nvarchar(50)", nullable: true),
  137. FRAME = table.Column<DateTime>(type: "datetime2", nullable: false),
  138. ISLAST = table.Column<bool>(type: "bit", nullable: false),
  139. WCSVERSION = table.Column<int>(type: "int", nullable: false)
  140. },
  141. constraints: table =>
  142. {
  143. table.PrimaryKey("PK_WCS_RGV520", x => x.ID);
  144. table.ForeignKey(
  145. name: "FK_WCS_RGV520_WCS_DEVICE_DEVICECODE",
  146. column: x => x.DEVICECODE,
  147. principalTable: "WCS_DEVICE",
  148. principalColumn: "CODE",
  149. onDelete: ReferentialAction.Restrict);
  150. });
  151. migrationBuilder.CreateTable(
  152. name: "WCS_RGV521",
  153. columns: table => new
  154. {
  155. ID = table.Column<int>(type: "int", nullable: false)
  156. .Annotation("SqlServer:Identity", "1, 1"),
  157. TaskID_1 = table.Column<int>(type: "int", nullable: false),
  158. TaskType_1 = table.Column<short>(type: "smallint", nullable: false),
  159. StartPosition_1 = table.Column<short>(type: "smallint", nullable: false),
  160. DestPosition_1 = table.Column<short>(type: "smallint", nullable: false),
  161. PRIORITY_1 = table.Column<short>(type: "smallint", nullable: false),
  162. ACT_V = table.Column<short>(type: "smallint", nullable: false),
  163. RES2_1 = table.Column<short>(type: "smallint", nullable: false),
  164. PH_Status_1 = table.Column<bool>(type: "bit", nullable: false),
  165. ToSition_1 = table.Column<bool>(type: "bit", nullable: false),
  166. Finish_1 = table.Column<bool>(type: "bit", nullable: false),
  167. TaskID_2 = table.Column<int>(type: "int", nullable: false),
  168. TaskType_2 = table.Column<short>(type: "smallint", nullable: false),
  169. StartPosition_2 = table.Column<short>(type: "smallint", nullable: false),
  170. DestPosition_2 = table.Column<short>(type: "smallint", nullable: false),
  171. PRIORITY_2 = table.Column<short>(type: "smallint", nullable: false),
  172. RES1_2 = table.Column<short>(type: "smallint", nullable: false),
  173. RES2_2 = table.Column<short>(type: "smallint", nullable: false),
  174. PH_Status_2 = table.Column<bool>(type: "bit", nullable: false),
  175. ToSition_2 = table.Column<bool>(type: "bit", nullable: false),
  176. Finish_2 = table.Column<bool>(type: "bit", nullable: false),
  177. SystemStatus = table.Column<short>(type: "smallint", nullable: false),
  178. WorkMode = table.Column<short>(type: "smallint", nullable: false),
  179. RES = table.Column<short>(type: "smallint", nullable: false),
  180. Position = table.Column<float>(type: "real", nullable: false),
  181. Mileage = table.Column<float>(type: "real", nullable: false),
  182. Runtime = table.Column<float>(type: "real", nullable: false),
  183. ENABLED = table.Column<bool>(type: "bit", nullable: false),
  184. UPDATEUSER = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
  185. UPDATETIME = table.Column<DateTime>(type: "datetime2", nullable: false),
  186. VER = table.Column<byte[]>(type: "rowversion", rowVersion: true, nullable: true),
  187. DEVICECODE = table.Column<string>(type: "nvarchar(50)", nullable: true),
  188. FRAME = table.Column<DateTime>(type: "datetime2", nullable: false),
  189. ISLAST = table.Column<bool>(type: "bit", nullable: false),
  190. WCSVERSION = table.Column<int>(type: "int", nullable: false)
  191. },
  192. constraints: table =>
  193. {
  194. table.PrimaryKey("PK_WCS_RGV521", x => x.ID);
  195. table.ForeignKey(
  196. name: "FK_WCS_RGV521_WCS_DEVICE_DEVICECODE",
  197. column: x => x.DEVICECODE,
  198. principalTable: "WCS_DEVICE",
  199. principalColumn: "CODE",
  200. onDelete: ReferentialAction.Restrict);
  201. });
  202. migrationBuilder.CreateTable(
  203. name: "WCS_RGV523",
  204. columns: table => new
  205. {
  206. ID = table.Column<int>(type: "int", nullable: false)
  207. .Annotation("SqlServer:Identity", "1, 1"),
  208. Fault = table.Column<int>(type: "int", nullable: false),
  209. Fault1 = table.Column<int>(type: "int", nullable: false),
  210. Fault2 = table.Column<int>(type: "int", nullable: false),
  211. Status = table.Column<int>(type: "int", nullable: false),
  212. Status1 = table.Column<int>(type: "int", nullable: false),
  213. Status2 = table.Column<int>(type: "int", nullable: false),
  214. ENABLED = table.Column<bool>(type: "bit", nullable: false),
  215. UPDATEUSER = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
  216. UPDATETIME = table.Column<DateTime>(type: "datetime2", nullable: false),
  217. VER = table.Column<byte[]>(type: "rowversion", rowVersion: true, nullable: true),
  218. DEVICECODE = table.Column<string>(type: "nvarchar(50)", nullable: true),
  219. FRAME = table.Column<DateTime>(type: "datetime2", nullable: false),
  220. ISLAST = table.Column<bool>(type: "bit", nullable: false),
  221. WCSVERSION = table.Column<int>(type: "int", nullable: false)
  222. },
  223. constraints: table =>
  224. {
  225. table.PrimaryKey("PK_WCS_RGV523", x => x.ID);
  226. table.ForeignKey(
  227. name: "FK_WCS_RGV523_WCS_DEVICE_DEVICECODE",
  228. column: x => x.DEVICECODE,
  229. principalTable: "WCS_DEVICE",
  230. principalColumn: "CODE",
  231. onDelete: ReferentialAction.Restrict);
  232. });
  233. migrationBuilder.CreateTable(
  234. name: "WCS_SC520",
  235. columns: table => new
  236. {
  237. ID = table.Column<int>(type: "int", nullable: false)
  238. .Annotation("SqlServer:Identity", "1, 1"),
  239. Handshake = table.Column<short>(type: "smallint", nullable: false),
  240. Startnumber1 = table.Column<short>(type: "smallint", nullable: false),
  241. Endnumber2 = table.Column<short>(type: "smallint", nullable: false),
  242. GoodsType = table.Column<short>(type: "smallint", nullable: false),
  243. SpeedMode = table.Column<short>(type: "smallint", nullable: false),
  244. SLine = table.Column<short>(type: "smallint", nullable: false),
  245. SCol = table.Column<short>(type: "smallint", nullable: false),
  246. SLayer = table.Column<short>(type: "smallint", nullable: false),
  247. SDepth = table.Column<short>(type: "smallint", nullable: false),
  248. ELine = table.Column<short>(type: "smallint", nullable: false),
  249. ECol = table.Column<short>(type: "smallint", nullable: false),
  250. ELayer = table.Column<short>(type: "smallint", nullable: false),
  251. EDepth = table.Column<short>(type: "smallint", nullable: false),
  252. TaskID = table.Column<int>(type: "int", nullable: false),
  253. Trigger = table.Column<short>(type: "smallint", nullable: false),
  254. ENABLED = table.Column<bool>(type: "bit", nullable: false),
  255. UPDATEUSER = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
  256. UPDATETIME = table.Column<DateTime>(type: "datetime2", nullable: false),
  257. VER = table.Column<byte[]>(type: "rowversion", rowVersion: true, nullable: true),
  258. DEVICECODE = table.Column<string>(type: "nvarchar(50)", nullable: true),
  259. FRAME = table.Column<DateTime>(type: "datetime2", nullable: false),
  260. ISLAST = table.Column<bool>(type: "bit", nullable: false),
  261. WCSVERSION = table.Column<int>(type: "int", nullable: false)
  262. },
  263. constraints: table =>
  264. {
  265. table.PrimaryKey("PK_WCS_SC520", x => x.ID);
  266. table.ForeignKey(
  267. name: "FK_WCS_SC520_WCS_DEVICE_DEVICECODE",
  268. column: x => x.DEVICECODE,
  269. principalTable: "WCS_DEVICE",
  270. principalColumn: "CODE",
  271. onDelete: ReferentialAction.Restrict);
  272. });
  273. migrationBuilder.CreateTable(
  274. name: "WCS_SC521",
  275. columns: table => new
  276. {
  277. ID = table.Column<int>(type: "int", nullable: false)
  278. .Annotation("SqlServer:Identity", "1, 1"),
  279. Handshake = table.Column<bool>(type: "bit", nullable: false),
  280. GetFinishi = table.Column<bool>(type: "bit", nullable: false),
  281. PutFinishi = table.Column<bool>(type: "bit", nullable: false),
  282. Alarm = table.Column<bool>(type: "bit", nullable: false),
  283. TaskFinishi = table.Column<bool>(type: "bit", nullable: false),
  284. Loaded = table.Column<bool>(type: "bit", nullable: false),
  285. ForkCenter = table.Column<bool>(type: "bit", nullable: false),
  286. RES = table.Column<byte>(type: "tinyint", nullable: false),
  287. Mode = table.Column<short>(type: "smallint", nullable: false),
  288. Status = table.Column<short>(type: "smallint", nullable: false),
  289. SLine = table.Column<short>(type: "smallint", nullable: false),
  290. SCol = table.Column<short>(type: "smallint", nullable: false),
  291. SLayer = table.Column<short>(type: "smallint", nullable: false),
  292. SDepth = table.Column<short>(type: "smallint", nullable: false),
  293. ELine = table.Column<short>(type: "smallint", nullable: false),
  294. ECol = table.Column<short>(type: "smallint", nullable: false),
  295. ELayer = table.Column<short>(type: "smallint", nullable: false),
  296. EDepth = table.Column<short>(type: "smallint", nullable: false),
  297. TaskID = table.Column<int>(type: "int", nullable: false),
  298. Trigger = table.Column<short>(type: "smallint", nullable: false),
  299. Line = table.Column<short>(type: "smallint", nullable: false),
  300. Col = table.Column<short>(type: "smallint", nullable: false),
  301. Layer = table.Column<short>(type: "smallint", nullable: false),
  302. FinishedTask = table.Column<int>(type: "int", nullable: false),
  303. TravelPos = table.Column<int>(type: "int", nullable: false),
  304. LiftPos = table.Column<int>(type: "int", nullable: false),
  305. ForkPos = table.Column<int>(type: "int", nullable: false),
  306. Startnumber1 = table.Column<short>(type: "smallint", nullable: false),
  307. Endnumber2 = table.Column<short>(type: "smallint", nullable: false),
  308. TotalKM = table.Column<float>(type: "real", nullable: false),
  309. GoodsType = table.Column<short>(type: "smallint", nullable: false),
  310. Runtime = table.Column<float>(type: "real", nullable: false),
  311. ENABLED = table.Column<bool>(type: "bit", nullable: false),
  312. UPDATEUSER = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
  313. UPDATETIME = table.Column<DateTime>(type: "datetime2", nullable: false),
  314. VER = table.Column<byte[]>(type: "rowversion", rowVersion: true, nullable: true),
  315. DEVICECODE = table.Column<string>(type: "nvarchar(50)", nullable: true),
  316. FRAME = table.Column<DateTime>(type: "datetime2", nullable: false),
  317. ISLAST = table.Column<bool>(type: "bit", nullable: false),
  318. WCSVERSION = table.Column<int>(type: "int", nullable: false)
  319. },
  320. constraints: table =>
  321. {
  322. table.PrimaryKey("PK_WCS_SC521", x => x.ID);
  323. table.ForeignKey(
  324. name: "FK_WCS_SC521_WCS_DEVICE_DEVICECODE",
  325. column: x => x.DEVICECODE,
  326. principalTable: "WCS_DEVICE",
  327. principalColumn: "CODE",
  328. onDelete: ReferentialAction.Restrict);
  329. });
  330. migrationBuilder.CreateTable(
  331. name: "WCS_SC537",
  332. columns: table => new
  333. {
  334. ID = table.Column<int>(type: "int", nullable: false)
  335. .Annotation("SqlServer:Identity", "1, 1"),
  336. SCAlarm = table.Column<decimal>(type: "decimal(20,0)", nullable: false),
  337. ENABLED = table.Column<bool>(type: "bit", nullable: false),
  338. UPDATEUSER = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
  339. UPDATETIME = table.Column<DateTime>(type: "datetime2", nullable: false),
  340. VER = table.Column<byte[]>(type: "rowversion", rowVersion: true, nullable: true),
  341. DEVICECODE = table.Column<string>(type: "nvarchar(50)", nullable: true),
  342. FRAME = table.Column<DateTime>(type: "datetime2", nullable: false),
  343. ISLAST = table.Column<bool>(type: "bit", nullable: false),
  344. WCSVERSION = table.Column<int>(type: "int", nullable: false)
  345. },
  346. constraints: table =>
  347. {
  348. table.PrimaryKey("PK_WCS_SC537", x => x.ID);
  349. table.ForeignKey(
  350. name: "FK_WCS_SC537_WCS_DEVICE_DEVICECODE",
  351. column: x => x.DEVICECODE,
  352. principalTable: "WCS_DEVICE",
  353. principalColumn: "CODE",
  354. onDelete: ReferentialAction.Restrict);
  355. });
  356. migrationBuilder.CreateTable(
  357. name: "WCS_STATION520",
  358. columns: table => new
  359. {
  360. ID = table.Column<int>(type: "int", nullable: false)
  361. .Annotation("SqlServer:Identity", "1, 1"),
  362. TASKNUM = table.Column<int>(type: "int", nullable: false),
  363. GOODSCODE = table.Column<short>(type: "smallint", nullable: false),
  364. GOODSTYPE = table.Column<short>(type: "smallint", nullable: false),
  365. GOODSSIZE = table.Column<short>(type: "smallint", nullable: false),
  366. GOODSSTART = table.Column<short>(type: "smallint", nullable: false),
  367. GOODSEND = table.Column<short>(type: "smallint", nullable: false),
  368. WEIGHT = table.Column<short>(type: "smallint", nullable: false),
  369. FLAGS = table.Column<short>(type: "smallint", nullable: false),
  370. CONFIRM = table.Column<short>(type: "smallint", nullable: false),
  371. ENABLED = table.Column<bool>(type: "bit", nullable: false),
  372. UPDATEUSER = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
  373. UPDATETIME = table.Column<DateTime>(type: "datetime2", nullable: false),
  374. VER = table.Column<byte[]>(type: "rowversion", rowVersion: true, nullable: true),
  375. DEVICECODE = table.Column<string>(type: "nvarchar(50)", nullable: true),
  376. FRAME = table.Column<DateTime>(type: "datetime2", nullable: false),
  377. ISLAST = table.Column<bool>(type: "bit", nullable: false),
  378. WCSVERSION = table.Column<int>(type: "int", nullable: false)
  379. },
  380. constraints: table =>
  381. {
  382. table.PrimaryKey("PK_WCS_STATION520", x => x.ID);
  383. table.ForeignKey(
  384. name: "FK_WCS_STATION520_WCS_DEVICE_DEVICECODE",
  385. column: x => x.DEVICECODE,
  386. principalTable: "WCS_DEVICE",
  387. principalColumn: "CODE",
  388. onDelete: ReferentialAction.Restrict);
  389. });
  390. migrationBuilder.CreateTable(
  391. name: "WCS_STATION521",
  392. columns: table => new
  393. {
  394. ID = table.Column<int>(type: "int", nullable: false)
  395. .Annotation("SqlServer:Identity", "1, 1"),
  396. TASKNUM = table.Column<int>(type: "int", nullable: false),
  397. GOODSCODE = table.Column<short>(type: "smallint", nullable: false),
  398. GOODSTYPE = table.Column<short>(type: "smallint", nullable: false),
  399. GOODSSIZE = table.Column<short>(type: "smallint", nullable: false),
  400. GOODSSTART = table.Column<short>(type: "smallint", nullable: false),
  401. GOODSEND = table.Column<short>(type: "smallint", nullable: false),
  402. REQUEST = table.Column<bool>(type: "bit", nullable: false),
  403. RES = table.Column<bool>(type: "bit", nullable: false),
  404. RES1 = table.Column<bool>(type: "bit", nullable: false),
  405. RES2 = table.Column<bool>(type: "bit", nullable: false),
  406. PH_STATUS = table.Column<bool>(type: "bit", nullable: false),
  407. GOODS_ERR = table.Column<bool>(type: "bit", nullable: false),
  408. F_OUTSIDE = table.Column<bool>(type: "bit", nullable: false),
  409. B_OUTSIDE = table.Column<bool>(type: "bit", nullable: false),
  410. L_OUTSIDE = table.Column<bool>(type: "bit", nullable: false),
  411. R_OUTSIDE = table.Column<bool>(type: "bit", nullable: false),
  412. H_OUTSIDE = table.Column<bool>(type: "bit", nullable: false),
  413. BCR_NOREAD = table.Column<bool>(type: "bit", nullable: false),
  414. OVERLOAD = table.Column<bool>(type: "bit", nullable: false),
  415. RES3 = table.Column<bool>(type: "bit", nullable: false),
  416. RES4 = table.Column<bool>(type: "bit", nullable: false),
  417. RES5 = table.Column<bool>(type: "bit", nullable: false),
  418. WEIGHT = table.Column<int>(type: "int", nullable: false),
  419. ENABLED = table.Column<bool>(type: "bit", nullable: false),
  420. UPDATEUSER = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
  421. UPDATETIME = table.Column<DateTime>(type: "datetime2", nullable: false),
  422. VER = table.Column<byte[]>(type: "rowversion", rowVersion: true, nullable: true),
  423. DEVICECODE = table.Column<string>(type: "nvarchar(50)", nullable: true),
  424. FRAME = table.Column<DateTime>(type: "datetime2", nullable: false),
  425. ISLAST = table.Column<bool>(type: "bit", nullable: false),
  426. WCSVERSION = table.Column<int>(type: "int", nullable: false)
  427. },
  428. constraints: table =>
  429. {
  430. table.PrimaryKey("PK_WCS_STATION521", x => x.ID);
  431. table.ForeignKey(
  432. name: "FK_WCS_STATION521_WCS_DEVICE_DEVICECODE",
  433. column: x => x.DEVICECODE,
  434. principalTable: "WCS_DEVICE",
  435. principalColumn: "CODE",
  436. onDelete: ReferentialAction.Restrict);
  437. });
  438. migrationBuilder.CreateTable(
  439. name: "WCS_STATION523",
  440. columns: table => new
  441. {
  442. ID = table.Column<int>(type: "int", nullable: false)
  443. .Annotation("SqlServer:Identity", "1, 1"),
  444. Fault = table.Column<int>(type: "int", nullable: false),
  445. RES = table.Column<int>(type: "int", nullable: false),
  446. Status = table.Column<short>(type: "smallint", nullable: false),
  447. RunTime = table.Column<float>(type: "real", nullable: false),
  448. ENABLED = table.Column<bool>(type: "bit", nullable: false),
  449. UPDATEUSER = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
  450. UPDATETIME = table.Column<DateTime>(type: "datetime2", nullable: false),
  451. VER = table.Column<byte[]>(type: "rowversion", rowVersion: true, nullable: true),
  452. DEVICECODE = table.Column<string>(type: "nvarchar(50)", nullable: true),
  453. FRAME = table.Column<DateTime>(type: "datetime2", nullable: false),
  454. ISLAST = table.Column<bool>(type: "bit", nullable: false),
  455. WCSVERSION = table.Column<int>(type: "int", nullable: false)
  456. },
  457. constraints: table =>
  458. {
  459. table.PrimaryKey("PK_WCS_STATION523", x => x.ID);
  460. table.ForeignKey(
  461. name: "FK_WCS_STATION523_WCS_DEVICE_DEVICECODE",
  462. column: x => x.DEVICECODE,
  463. principalTable: "WCS_DEVICE",
  464. principalColumn: "CODE",
  465. onDelete: ReferentialAction.Restrict);
  466. });
  467. migrationBuilder.CreateTable(
  468. name: "WCS_DATABLOCK",
  469. columns: table => new
  470. {
  471. CODE = table.Column<string>(type: "nvarchar(20)", maxLength: 20, nullable: false),
  472. NAME = table.Column<string>(type: "nvarchar(20)", maxLength: 20, nullable: true),
  473. PLCCODE = table.Column<string>(type: "nvarchar(20)", nullable: true),
  474. NO = table.Column<int>(type: "int", nullable: false),
  475. LENGTH = table.Column<int>(type: "int", nullable: false),
  476. DATALENGTH = table.Column<int>(type: "int", nullable: false),
  477. PROTOCOL = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: false),
  478. NOUPDATE = table.Column<bool>(type: "bit", nullable: false),
  479. ENABLED = table.Column<bool>(type: "bit", nullable: false),
  480. UPDATEUSER = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
  481. UPDATETIME = table.Column<DateTime>(type: "datetime2", nullable: false),
  482. VER = table.Column<byte[]>(type: "rowversion", rowVersion: true, nullable: true)
  483. },
  484. constraints: table =>
  485. {
  486. table.PrimaryKey("PK_WCS_DATABLOCK", x => x.CODE);
  487. table.ForeignKey(
  488. name: "FK_WCS_DATABLOCK_WCS_PLC_PLCCODE",
  489. column: x => x.PLCCODE,
  490. principalTable: "WCS_PLC",
  491. principalColumn: "CODE",
  492. onDelete: ReferentialAction.Restrict);
  493. });
  494. migrationBuilder.CreateTable(
  495. name: "WCS_DEVICEPROTOCOL",
  496. columns: table => new
  497. {
  498. ID = table.Column<int>(type: "int", nullable: false)
  499. .Annotation("SqlServer:Identity", "1, 1"),
  500. DEVICECODE = table.Column<string>(type: "nvarchar(50)", nullable: false),
  501. DBCODE = table.Column<string>(type: "nvarchar(20)", nullable: true),
  502. POSITION = table.Column<short>(type: "smallint", nullable: false),
  503. ENABLED = table.Column<bool>(type: "bit", nullable: false),
  504. UPDATEUSER = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
  505. UPDATETIME = table.Column<DateTime>(type: "datetime2", nullable: false),
  506. VER = table.Column<byte[]>(type: "rowversion", rowVersion: true, nullable: true)
  507. },
  508. constraints: table =>
  509. {
  510. table.PrimaryKey("PK_WCS_DEVICEPROTOCOL", x => x.ID);
  511. table.ForeignKey(
  512. name: "FK_WCS_DEVICEPROTOCOL_WCS_DATABLOCK_DBCODE",
  513. column: x => x.DBCODE,
  514. principalTable: "WCS_DATABLOCK",
  515. principalColumn: "CODE",
  516. onDelete: ReferentialAction.Restrict);
  517. table.ForeignKey(
  518. name: "FK_WCS_DEVICEPROTOCOL_WCS_DEVICE_DEVICECODE",
  519. column: x => x.DEVICECODE,
  520. principalTable: "WCS_DEVICE",
  521. principalColumn: "CODE",
  522. onDelete: ReferentialAction.Cascade);
  523. });
  524. migrationBuilder.CreateIndex(
  525. name: "IX_WCS_BCR80_DEVICECODE",
  526. table: "WCS_BCR80",
  527. column: "DEVICECODE");
  528. migrationBuilder.CreateIndex(
  529. name: "IX_WCS_DATABLOCK_PLCCODE",
  530. table: "WCS_DATABLOCK",
  531. column: "PLCCODE");
  532. migrationBuilder.CreateIndex(
  533. name: "IX_WCS_DEVICEPROTOCOL_DBCODE",
  534. table: "WCS_DEVICEPROTOCOL",
  535. column: "DBCODE");
  536. migrationBuilder.CreateIndex(
  537. name: "IX_WCS_DEVICEPROTOCOL_DEVICECODE",
  538. table: "WCS_DEVICEPROTOCOL",
  539. column: "DEVICECODE");
  540. migrationBuilder.CreateIndex(
  541. name: "IX_WCS_RGV520_DEVICECODE",
  542. table: "WCS_RGV520",
  543. column: "DEVICECODE");
  544. migrationBuilder.CreateIndex(
  545. name: "IX_WCS_RGV521_DEVICECODE",
  546. table: "WCS_RGV521",
  547. column: "DEVICECODE");
  548. migrationBuilder.CreateIndex(
  549. name: "IX_WCS_RGV523_DEVICECODE",
  550. table: "WCS_RGV523",
  551. column: "DEVICECODE");
  552. migrationBuilder.CreateIndex(
  553. name: "IX_WCS_SC520_DEVICECODE",
  554. table: "WCS_SC520",
  555. column: "DEVICECODE");
  556. migrationBuilder.CreateIndex(
  557. name: "IX_WCS_SC521_DEVICECODE",
  558. table: "WCS_SC521",
  559. column: "DEVICECODE");
  560. migrationBuilder.CreateIndex(
  561. name: "IX_WCS_SC537_DEVICECODE",
  562. table: "WCS_SC537",
  563. column: "DEVICECODE");
  564. migrationBuilder.CreateIndex(
  565. name: "IX_WCS_STATION520_DEVICECODE",
  566. table: "WCS_STATION520",
  567. column: "DEVICECODE");
  568. migrationBuilder.CreateIndex(
  569. name: "IX_WCS_STATION521_DEVICECODE",
  570. table: "WCS_STATION521",
  571. column: "DEVICECODE");
  572. migrationBuilder.CreateIndex(
  573. name: "IX_WCS_STATION523_DEVICECODE",
  574. table: "WCS_STATION523",
  575. column: "DEVICECODE");
  576. }
  577. protected override void Down(MigrationBuilder migrationBuilder)
  578. {
  579. migrationBuilder.DropTable(
  580. name: "WCS_BCR80");
  581. migrationBuilder.DropTable(
  582. name: "WCS_CMD");
  583. migrationBuilder.DropTable(
  584. name: "WCS_DEVICEPROTOCOL");
  585. migrationBuilder.DropTable(
  586. name: "WCS_EXCEPTION");
  587. migrationBuilder.DropTable(
  588. name: "WCS_RGV520");
  589. migrationBuilder.DropTable(
  590. name: "WCS_RGV521");
  591. migrationBuilder.DropTable(
  592. name: "WCS_RGV523");
  593. migrationBuilder.DropTable(
  594. name: "WCS_SC520");
  595. migrationBuilder.DropTable(
  596. name: "WCS_SC521");
  597. migrationBuilder.DropTable(
  598. name: "WCS_SC537");
  599. migrationBuilder.DropTable(
  600. name: "WCS_STATION520");
  601. migrationBuilder.DropTable(
  602. name: "WCS_STATION521");
  603. migrationBuilder.DropTable(
  604. name: "WCS_STATION523");
  605. migrationBuilder.DropTable(
  606. name: "WCS_DATABLOCK");
  607. migrationBuilder.DropTable(
  608. name: "WCS_DEVICE");
  609. migrationBuilder.DropTable(
  610. name: "WCS_PLC");
  611. }
  612. }
  613. }